def message_to_object(msg): code = msg.get_command() if code == M_WALL_UPDATE: obj = WallData() elif code == M_NPC_UPDATE: obj = NPCData() elif code == M_MISSILE_UPDATE: obj = MissileData() elif code == M_PLAYER_UPDATE: obj = PlayerData() else: obj = None if obj: obj.set_from_message(msg) return obj
def get_wall(self): wall = WallData() wall.set_from_message(self) return wall