# HG changeset patch # User KarstenBock@gmx.net # Date 1316783307 -7200 # Node ID b10d12fbbb3fd2d2cf861279b1f848060c1a34ba # Parent 7b084602541218fc0075c52485360f63681e0324 Added moveObject method to the GameModel class. diff -r 7b0846025412 -r b10d12fbbb3f src/parpg/gamemodel.py --- a/src/parpg/gamemodel.py Fri Sep 23 14:43:06 2011 +0200 +++ b/src/parpg/gamemodel.py Fri Sep 23 15:08:27 2011 +0200 @@ -136,6 +136,16 @@ ID = ID + "_" + str(id_number) return ID + def moveObject(self, object_id, new_map): + """Moves the object to a new map, or in a container + @param object_id: ID of the object + @type object_id: str + @param new_map: ID of the new map, or None + @type object_id: str """ + game_object = self.game_state.getObjectById(object_id) + self.deleteObject(object_id) + self.game_state.addObject(object_id, new_map, game_object) + def deleteObject(self, object_id): """Removes an object from the game @param object_id: ID of the object