diff gamemodel.py @ 127:18623b5c2b45

Fixed that dropped items cannot be picked up.
author KarstenBock@gmx.net
date Fri, 07 Oct 2011 14:36:36 +0200
parents 452bbc3d915d
children d1c2d316cc25
line wrap: on
line diff
--- a/gamemodel.py	Fri Oct 07 14:16:21 2011 +0200
+++ b/gamemodel.py	Fri Oct 07 14:36:36 2011 +0200
@@ -669,15 +669,17 @@
     def updateObjectDB(self, world):
         """Updates the values in the object database with the worlds values"""
         
+        all_agents = self.agents[self.ALL_AGENTS_KEY]
         for entity in world.entities:
             identifier = entity.general.identifier
             agent_data = {}
             map_id = self.game_state.getMapOfObject(identifier)
             if map_id:
-                if self.agents[self.ALL_AGENTS_KEY].has_key(identifier):
+                if all_agents.has_key(identifier):
                     agent_data = self.agents[self.ALL_AGENTS_KEY][identifier]
                 else:
                     agent_data = self.agents[map_id][identifier]
+
             else:
                 if not self.items.has_key(identifier):
                     self.items[identifier] = {}
@@ -704,7 +706,8 @@
                             inst = layer.getInstance(identifier)
                             loc = inst.getLocation().getExactLayerCoordinates()
                             agent_data["Position"] = (loc.x, loc.y, loc.z)
-                            agent_data["Map"] = map_id
+                            if all_agents.has_key(identifier):
+                                agent_data["Map"] = map_id
                             agent_data["Rotation"]  = inst.getRotation()
                     elif name == "container" and hasattr(comp_vals, 
                                                          "children"):