Mercurial > parpg-source
comparison gamestate.py @ 88:0411a4bcceee
Fixed moving between maps.
author | KarstenBock@gmx.net |
---|---|
date | Mon, 26 Sep 2011 15:44:42 +0200 |
parents | 9e03f7816061 |
children | 824f3068ef2a |
comparison
equal
deleted
inserted
replaced
87:aed2e094e0c7 | 88:0411a4bcceee |
---|---|
52 if self.hasObject(object_id): | 52 if self.hasObject(object_id): |
53 map_id = self.getMapOfObject(object_id) | 53 map_id = self.getMapOfObject(object_id) |
54 if map_id: | 54 if map_id: |
55 inst = self.maps[map_id].agent_layer.getInstance(object_id) | 55 inst = self.maps[map_id].agent_layer.getInstance(object_id) |
56 self.maps[map_id].agent_layer.deleteInstance(inst) | 56 self.maps[map_id].agent_layer.deleteInstance(inst) |
57 self.objects[map_id][object_id].delete() | |
57 del self.objects[map_id][object_id] | 58 del self.objects[map_id][object_id] |
58 del self.object_ids[object_id] | 59 del self.object_ids[object_id] |
59 | 60 |
60 | 61 |
61 def getObjectsFromMap(self, map_id): | 62 def getObjectsFromMap(self, map_id): |
66 if map_id in self.objects: | 67 if map_id in self.objects: |
67 return [i for i in self.objects[map_id].values() \ | 68 return [i for i in self.objects[map_id].values() \ |
68 if map_id in self.objects] | 69 if map_id in self.objects] |
69 | 70 |
70 return {} | 71 return {} |
72 | |
73 def deleteObjectsFromMap(self, map_id): | |
74 """Deletes all objects of the given map. | |
75 @type map: String | |
76 @param map: The map name. | |
77 @returns: None""" | |
78 if map_id in self.objects: | |
79 for obj in self.objects[map_id].copy(): | |
80 self.deleteObject(obj) | |
71 | 81 |
72 def hasObject(self, object_id): | 82 def hasObject(self, object_id): |
73 """Check if an object with the given id is present | 83 """Check if an object with the given id is present |
74 @param object_id: ID of the object | 84 @param object_id: ID of the object |
75 @type object_id: str | 85 @type object_id: str |