diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-10-09 12:07:25 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-10-09 12:07:25 +0000 |
commit | 6f706879515b4e37a78994aaae6b0e36d00b5f32 (patch) | |
tree | 33785b722f71a1496fc88e4a619dedbc7f716ea8 /src/game.cpp | |
parent | 8bde9095c5840b8d62ebafe11beaed98877d6ac2 (diff) | |
download | mana-6f706879515b4e37a78994aaae6b0e36d00b5f32.tar.gz mana-6f706879515b4e37a78994aaae6b0e36d00b5f32.tar.bz2 mana-6f706879515b4e37a78994aaae6b0e36d00b5f32.tar.xz mana-6f706879515b4e37a78994aaae6b0e36d00b5f32.zip |
Fixed map switch to crash the client.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/game.cpp b/src/game.cpp index d85149fe..e8692fd9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1472,35 +1472,22 @@ void do_parse() { // Set new map path map_path = "maps/" + msg.readString(16); - map_path= map_path.substr(0, map_path.rfind(".")) + ".tmx.gz"; + map_path = map_path.substr(0, map_path.rfind(".")) + + ".tmx.gz"; Uint16 x = msg.readShort(); Uint16 y = msg.readShort(); - logger->log("Warping to %s (%d, %d)", map_path.c_str(), x, y); + logger->log("Warping to %s (%d, %d)", + map_path.c_str(), x, y); + // Switch the actual map, deleting the previous one engine->changeMap(map_path); tiledMap = engine->getCurrentMap(); - empty_floor_items(); - - // Remove the player, so it is not deleted - beings.remove(player_node); - - // Delete all beings except the local player - std::list<Being *>::iterator i; - for (i = beings.begin(); i != beings.end(); i++) - { - delete (*i); - } - beings.clear(); - autoTarget = NULL; current_npc = 0; - // Re-add the local player node - beings.push_back(player_node); - player_node->action = Being::STAND; player_node->mFrame = 0; player_node->x = x; |