- Timestamp:
- 10/23/09 18:18:29 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/game/scripts/engine.py
r340 r341 52 52 @param filename: the name of the file to write to 53 53 @return: None""" 54 fname = '/'.join([path, filename])54 fname = '/'.join([path, filename]) 55 55 try: 56 56 f = open(fname, 'w') … … 61 61 # can't pickle SwigPyObjects 62 62 behaviours = {} 63 behaviour_player = self.game_state.PC.behaviour ;64 self.game_state.PC.behaviour = None ;63 behaviour_player = self.game_state.PC.behaviour 64 self.game_state.PC.behaviour = None 65 65 66 66 # Backup the behaviours … … 70 70 if npc.trueAttr("NPC"): 71 71 behaviours[map_id][object_id] = npc.behaviour 72 npc.behaviour = None ;72 npc.behaviour = None 73 73 74 74 # Pickle it … … 78 78 # Restore behaviours 79 79 for map_id in behaviours: 80 for (object_id, behaviour) in behaviours[map_id].items():80 for (object_id, behaviour) in behaviours[map_id].items(): 81 81 self.game_state.objects[map_id][object_id].behaviour = \ 82 82 behaviours[map_id][object_id] … … 163 163 if ref is None: 164 164 # no, add it to the game state 165 self.game_state.objects[self.game_state.current_map_name][obj.ID] = obj 165 self.game_state.objects[self.game_state.current_map_name][obj.ID] \ 166 = obj 166 167 else: 167 168 # yes, use the current game state data … … 184 185 @rtype: boolean 185 186 @return: Status of result (True/False)""" 186 for i in self.game_state.getObjectsFromMap(self.game_state.current_map_name): 187 for i in \ 188 self.game_state.getObjectsFromMap(self.game_state.current_map_name): 187 189 if (i.ID == ident): 188 190 # we found a match … … 197 199 @rtype: list 198 200 @return: List of text and callbacks""" 199 actions =[]201 actions = [] 200 202 # note: ALWAYS check NPC's first! 201 203 obj = self.game_state.getObjectById(obj_id, \ … … 271 273 self.game_state.PC.start() 272 274 273 def handleMouseClick(self, position):275 def handleMouseClick(self, position): 274 276 """Code called when user left clicks the screen. 275 277 @type position: fife.ScreenPoint
Note: See TracChangeset
for help on using the changeset viewer.