Package horizons :: Module spsession :: Class SPSession
[hide private]
[frames] | no frames]

Class SPSession

source code

util.living.LivingObject --+    
                           |    
             session.Session --+
                               |
                              SPSession

Session tailored for singleplayer games.

Instance Methods [hide private]
 
create_manager(self)
Returns instance of command manager (currently MPManager or SPManager)
source code
 
create_rng(self, seed=None)
Returns a RNG (random number generator).
source code
 
create_timer(self)
Returns a Timer instance.
source code
 
load(self, *args, **kwargs)
Loads a map.
source code
 
autosave(self)
Called automatically in an interval
source code
 
quicksave(self)
Called when user presses the quicksave hotkey
source code
 
save(self, savegamename=None)
Saves a game
source code
    Inherited from session.Session
 
__init__(self, db, rng_seed=None, ingame_gui_class=IngameGui) source code
 
_do_save(self, savegame)
Actual save code.
source code
 
_on_setting_changed(self, message) source code
 
end(self)
Put all the code the object needs to end safely here.
source code
 
is_game_loaded(self)
Checks if the current game is a new one, or a loaded one.
source code
 
quickload(self) source code
 
quit(self) source code
 
remove_selected(self) source code
 
reset_autosave(self)
(Re-)Set up autosave.
source code
 
speed_down(self) source code
 
speed_is_paused(self) source code
 
speed_pause(self, suggestion=False) source code
 
speed_set(self, ticks, suggestion=False)
Set game speed to ticks ticks per second
source code
 
speed_toggle_pause(self, suggestion=False) source code
 
speed_unpause(self, suggestion=False) source code
 
speed_up(self) source code
 
start(self)
Actually starts the game.
source code
Class Methods [hide private]
    Inherited from session.Session
 
_clear_caches(cls)
Clear all data caches in global namespace related to a session
source code
Class Variables [hide private]
    Inherited from session.Session
  _pause_stack = 0
  ingame_gui = livingProperty()
  log = logging.getLogger('session')
  manager = livingProperty()
  scenario_eventhandler = livingProperty()
  timer = livingProperty()
  view = livingProperty()
Method Details [hide private]

create_manager(self)

source code 

Returns instance of command manager (currently MPManager or SPManager)

Overrides: session.Session.create_manager
(inherited documentation)

create_rng(self, seed=None)

source code 

Returns a RNG (random number generator). Must support the python random.Random interface

Overrides: session.Session.create_rng
(inherited documentation)

create_timer(self)

source code 

Returns a Timer instance.

Overrides: session.Session.create_timer
(inherited documentation)

load(self, *args, **kwargs)

source code 

Loads a map. Key method for starting a game.

Overrides: session.Session.load
(inherited documentation)

autosave(self)

source code 

Called automatically in an interval

Overrides: session.Session.autosave

quicksave(self)

source code 

Called when user presses the quicksave hotkey

Overrides: session.Session.quicksave

save(self, savegamename=None)

source code 

Saves a game

Parameters:
  • savegamename - string with the full path of the savegame file or None to let user pick one
Returns:
bool, whether no error happened (user aborting dialog means success)
Overrides: session.Session.save