From 363527d0f95963ba3f4a6d25c8eabc1bb3ad4efe Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 19 Feb 2010 22:38:59 +0100 Subject: Fixed a crash when trying to switch servers Ownership of the charInfo global variable wasn't well defined. It was being locked, unlocked and generally modified from a lot of places, and somewhere in this mess it ended up crashing when switching servers. Now the CharHandler instances, for eAthena and manaserv respectively, own this list of characters. A new class, Net::Character wraps up the slot index in combination with the player dummy. The list is passed on to the CharSelectDialog each time it changes. Both related and unrelated cleanups were made as well. Reviewed-by: Jared Adams --- src/net/manaserv/itemhandler.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/net/manaserv/itemhandler.cpp') diff --git a/src/net/manaserv/itemhandler.cpp b/src/net/manaserv/itemhandler.cpp index 802f9303..c939589e 100644 --- a/src/net/manaserv/itemhandler.cpp +++ b/src/net/manaserv/itemhandler.cpp @@ -58,12 +58,9 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) if (itemId) { - Game *game = Game::instance(); - Map *map = 0; - if (game) + if (Game *game = Game::instance()) { - map = game->getCurrentMap(); - if (map) + if (Map *map = game->getCurrentMap()) { floorItemManager->create(id, itemId, @@ -71,9 +68,11 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) y / map->getTileHeight()); } else - logger->log( - "ItemHandler: An item wasn't created because of" - "Game/Map not initialized..."); + { + logger->log( + "ItemHandler: An item wasn't created " + "because of Game/Map not initialized..."); + } } } else if (FloorItem *item = floorItemManager->findById(id)) -- cgit v1.2.3-70-g09d2