comparison gamestate.py @ 73:5c751b9a3d8b

The addObject method of the GameState class now accepts an object_id parameter, instead of it getting that value from the object.
author KarstenBock@gmx.net
date Thu, 22 Sep 2011 14:29:28 +0200
parents d4f213b99d41
children c9818290bbe7
comparison
equal deleted inserted replaced
72:783dc57eca7c 73:5c751b9a3d8b
26 self.current_map_name = None 26 self.current_map_name = None
27 self.maps = {} 27 self.maps = {}
28 self.npcs_met = set() 28 self.npcs_met = set()
29 29
30 30
31 def addObject(self, map_id, game_object): 31 def addObject(self, object_id, map_id, game_object):
32 """Adds an object to the objects and object_ids 32 """Adds an object to the objects and object_ids
33 dictionaries. 33 dictionaries.
34 @param object_id: ID of the object
35 @type object_id: str
34 @param map_id: ID of the map the object is on. 36 @param map_id: ID of the map the object is on.
35 If the object is in a container this has to be None 37 If the object is in a container this has to be None
38 @type map_id: str or None
36 @param object: object to be added 39 @param object: object to be added
37 @type object: GameObject 40 @type object: GameObject
38 @type map_id: str or None
39 """ 41 """
40 object_id = game_object.fifeagent.identifier
41 if not self.object_ids.has_key(object_id): 42 if not self.object_ids.has_key(object_id):
42 if map_id: 43 if map_id:
43 self.objects[map_id][object_id] = game_object 44 self.objects[map_id][object_id] = game_object
44 self.object_ids[object_id] = map_id 45 self.object_ids[object_id] = map_id
45 46