Changeset 432


Ignore:
Timestamp:
12/06/09 18:47:12 (9 years ago)
Author:
Kaydeth_parpg
Message:

Ticket #234. Patch by Kaydeth. Added some error checking to the getObjectsFromMap method in GameState?. This way it can return an empty list if the given map_id doesn't exist in the GameState?. fixes[s:trac, t:234]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/gamestate.py

    r361 r432  
    3636           @type map: String 
    3737           @param map: The map name. 
    38            @returns: The list of objects on this map.""" 
    39         return [i for i in self.objects[map_id].values() if map_id in self.objects] 
     38           @returns: The list of objects on this map. Or an empty list""" 
     39         
     40        if map_id in self.objects: 
     41            return [i for i in self.objects[map_id].values() if map_id in self.objects] 
     42         
     43        return {} 
    4044     
    4145    def getObjectById(self, obj_id, map_id): 
Note: See TracChangeset for help on using the changeset viewer.