Package horizons :: Module mpsession :: Class MPSession
[hide private]
[frames] | no frames]

Class MPSession

source code

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

Session class for multiplayer games.

Instance Methods [hide private]
 
__init__(self, db, network_interface, **kwargs) source code
 
_start_game(self, game) source code
 
_on_error(self, exception, fatal=True)
Error callback
source code
 
speed_set(self, ticks, suggestion=False)
Set game speed to ticks ticks per second
source code
 
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
 
end(self)
Put all the code the object needs to end safely here.
source code
 
autosave(self) source code
 
quicksave(self) source code
 
quickload(self) source code
 
save(self, savegamename=None) source code
    Inherited from session.Session
 
_do_save(self, savegame)
Actual save code.
source code
 
_on_setting_changed(self, message) source code
 
is_game_loaded(self)
Checks if the current game is a new one, or a loaded one.
source code
 
load(self, options)
Loads a map.
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_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]

__init__(self, db, network_interface, **kwargs)
(Constructor)

source code 
Parameters:
  • network_interface - instance of NetworkInterface to use for this game
  • rng_seed - seed for random number generator
Overrides: session.Session.__init__

speed_set(self, ticks, suggestion=False)

source code 

Set game speed to ticks ticks per second

Overrides: session.Session.speed_set

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)

end(self)

source code 

Put all the code the object needs to end safely here. Make sure it always contains the super(YOUROBJECT, self).end() call, to ensure all parentobjects are deinited correctly.

Overrides: util.living.LivingObject.end
(inherited documentation)

autosave(self)

source code 
Overrides: session.Session.autosave

quicksave(self)

source code 
Overrides: session.Session.quicksave

quickload(self)

source code 
Overrides: session.Session.quickload

save(self, savegamename=None)

source code 
Overrides: session.Session.save