diff src/parpg/gamestate.py @ 118:29869273f9e1

Fixed moving between maps.
author KarstenBock@gmx.net
date Mon, 26 Sep 2011 15:44:42 +0200
parents 7829eb185d6f
children 0ffebdca7ba3
line wrap: on
line diff
--- a/src/parpg/gamestate.py	Sat Sep 24 16:48:06 2011 +0200
+++ b/src/parpg/gamestate.py	Mon Sep 26 15:44:42 2011 +0200
@@ -54,6 +54,7 @@
             if map_id:
                 inst = self.maps[map_id].agent_layer.getInstance(object_id)
                 self.maps[map_id].agent_layer.deleteInstance(inst)
+            self.objects[map_id][object_id].delete()
             del self.objects[map_id][object_id]
             del self.object_ids[object_id]
             
@@ -69,6 +70,15 @@
         
         return {}
     
+    def deleteObjectsFromMap(self, map_id):
+        """Deletes all objects of the given map.
+           @type map: String
+           @param map: The map name.
+           @returns: None"""
+        if map_id in self.objects:
+            for obj in self.objects[map_id].copy():
+                self.deleteObject(obj)
+    
     def hasObject(self, object_id):
         """Check if an object with the given id is present 
         @param object_id: ID of the object