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/ea/charserverhandler.h | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/net/ea/charserverhandler.h') diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h index b159c63b..d96da452 100644 --- a/src/net/ea/charserverhandler.h +++ b/src/net/ea/charserverhandler.h @@ -42,9 +42,6 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler virtual void handleMessage(Net::MessageIn &msg); - void setCharInfo(LockedArray *charInfo) - { mCharInfo = charInfo; } - void setCharSelectDialog(CharSelectDialog *window); /** @@ -54,31 +51,28 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler */ void setCharCreateDialog(CharCreateDialog *window); - void getCharacters(); + void requestCharacters(); - void chooseCharacter(int slot, LocalPlayer* character); + void chooseCharacter(Net::Character *character); void newCharacter(const std::string &name, int slot, bool gender, - int hairstyle, int hairColor, std::vector stats); + int hairstyle, int hairColor, + const std::vector &stats); - void deleteCharacter(int slot, LocalPlayer* character); + void deleteCharacter(Net::Character *character); void switchCharacter(); - unsigned int baseSprite() const; + int baseSprite() const; - unsigned int hairSprite() const; + int hairSprite() const; - unsigned int maxSprite() const; + int maxSprite() const; void connect(); - protected: - LockedArray *mCharInfo; - CharSelectDialog *mCharSelectDialog; - CharCreateDialog *mCharCreateDialog; - - LocalPlayer *readPlayerData(Net::MessageIn &msg, int &slot); + private: + LocalPlayer *readPlayerData(Net::MessageIn &msg, int *slot); }; } // namespace EAthena -- cgit v1.2.3-70-g09d2