summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-17 14:51:23 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-17 14:51:23 +0300
commitc4802097dec05ca39e395e7dba3a55dba70edbe8 (patch)
treeb78e4d197a6e88dd646bc46b1c00286f97c63011
parente0bd37fd01e8c14bf6d044382ac12cc11f5eaa43 (diff)
downloadplus-c4802097dec05ca39e395e7dba3a55dba70edbe8.tar.gz
plus-c4802097dec05ca39e395e7dba3a55dba70edbe8.tar.bz2
plus-c4802097dec05ca39e395e7dba3a55dba70edbe8.tar.xz
plus-c4802097dec05ca39e395e7dba3a55dba70edbe8.zip
Add static in chatserverhandler.
-rw-r--r--src/net/charserverhandler.cpp5
-rw-r--r--src/net/charserverhandler.h31
-rw-r--r--src/net/ea/charserverhandler.cpp2
-rw-r--r--src/net/ea/charserverhandler.h12
-rw-r--r--src/net/eathena/charserverhandler.cpp21
-rw-r--r--src/net/eathena/charserverhandler.h22
-rw-r--r--src/net/tmwa/charserverhandler.cpp4
-rw-r--r--src/net/tmwa/charserverhandler.h6
8 files changed, 59 insertions, 44 deletions
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index 4d3cbc7ea..917257f2c 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -28,6 +28,11 @@
namespace Net
{
+Net::Characters CharServerHandler::mCharacters;
+Net::Character *CharServerHandler::mSelectedCharacter = nullptr;
+CharSelectDialog *CharServerHandler::mCharSelectDialog = nullptr;
+CharCreateDialog *CharServerHandler::mCharCreateDialog = nullptr;
+
void CharServerHandler::updateCharSelectDialog()
{
if (mCharSelectDialog)
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index 549c14688..3ba7f6cb5 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -34,6 +34,8 @@ class CharSelectDialog;
namespace Net
{
+class MessageIn;
+
struct Character;
typedef std::list<Character*> Characters;
@@ -82,25 +84,30 @@ class CharServerHandler notfinal
virtual void changeSlot(const int oldSlot, const int newSlot) = 0;
+ virtual void readPlayerData(Net::MessageIn &msg,
+ Net::Character *const character,
+ const bool withColors) const = 0;
+
protected:
- CharServerHandler() :
- mCharacters(),
- mSelectedCharacter(nullptr),
- mCharSelectDialog(nullptr),
- mCharCreateDialog(nullptr)
- {}
+ CharServerHandler()
+ {
+ mCharacters.clear();
+ mSelectedCharacter = nullptr;
+ mCharSelectDialog = nullptr;
+ mCharCreateDialog = nullptr;
+ }
- void updateCharSelectDialog();
- void unlockCharSelectDialog();
+ static void updateCharSelectDialog();
+ static void unlockCharSelectDialog();
/** The list of available characters. */
- Net::Characters mCharacters;
+ static Net::Characters mCharacters;
/** The selected character. */
- Net::Character *mSelectedCharacter;
+ static Net::Character *mSelectedCharacter;
- CharSelectDialog *mCharSelectDialog;
- CharCreateDialog *mCharCreateDialog;
+ static CharSelectDialog *mCharSelectDialog;
+ static CharCreateDialog *mCharCreateDialog;
};
} // namespace Net
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 015904918..8c400852b 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -77,7 +77,7 @@ unsigned int CharServerHandler::maxSprite() const
return EA_SPRITE_VECTOREND;
}
-void CharServerHandler::processCharLoginError(Net::MessageIn &msg) const
+void CharServerHandler::processCharLoginError(Net::MessageIn &msg)
{
BLOCK_START("CharServerHandler::processCharLoginError")
switch (msg.readUInt8("error"))
diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h
index c9b324c5b..0609e7637 100644
--- a/src/net/ea/charserverhandler.h
+++ b/src/net/ea/charserverhandler.h
@@ -54,22 +54,18 @@ class CharServerHandler notfinal : public Net::CharServerHandler
virtual void connect() = 0;
- virtual void processCharLoginError(Net::MessageIn &msg) const;
+ static void processCharLoginError(Net::MessageIn &msg);
- virtual void processCharCreateFailed(Net::MessageIn &msg);
+ static void processCharCreateFailed(Net::MessageIn &msg);
- virtual void processCharDelete(Net::MessageIn &msg);
+ static void processCharDelete(Net::MessageIn &msg);
- virtual void processCharDeleteFailed(Net::MessageIn &msg);
+ static void processCharDeleteFailed(Net::MessageIn &msg);
virtual void clear() override final;
protected:
CharServerHandler();
-
- virtual void readPlayerData(Net::MessageIn &msg,
- Net::Character *const character,
- const bool withColors) const = 0;
};
} // namespace Ea
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 5db0a0d79..3329f919b 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -61,15 +61,22 @@ namespace EAthena
extern ServerInfo charServer;
extern ServerInfo mapServer;
+std::string CharServerHandler::mNewName;
+uint32_t CharServerHandler::mPinSeed = 0;
+uint32_t CharServerHandler::mPinAccountId = 0;
+uint32_t CharServerHandler::mRenameId = 0;
+bool CharServerHandler::mNeedCreatePin = false;
+
CharServerHandler::CharServerHandler() :
MessageHandler(),
- Ea::CharServerHandler(),
- mNewName(),
- mPinSeed(0),
- mPinAccountId(0),
- mRenameId(0),
- mNeedCreatePin(false)
+ Ea::CharServerHandler()
{
+ mNewName.clear();
+ mPinSeed = 0;
+ mPinAccountId = 0;
+ mRenameId = 0;
+ mNeedCreatePin = false;
+
static const uint16_t _messages[] =
{
SMSG_CHAR_LOGIN,
@@ -479,7 +486,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg)
{
BLOCK_START("CharServerHandler::processCharCreate")
Net::Character *const character = new Net::Character;
- readPlayerData(msg, character, false);
+ charServerHandler->readPlayerData(msg, character, false);
mCharacters.push_back(character);
updateCharSelectDialog();
diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h
index 8b348271a..0e029e076 100644
--- a/src/net/eathena/charserverhandler.h
+++ b/src/net/eathena/charserverhandler.h
@@ -81,29 +81,29 @@ class CharServerHandler final : public MessageHandler,
void changeSlot(const int oldSlot, const int newSlot) override final;
- protected:
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character,
const bool) const override final;
- void processPincodeStatus(Net::MessageIn &msg);
+ protected:
+ static void processPincodeStatus(Net::MessageIn &msg);
static void processCharLogin2(Net::MessageIn &msg);
- void processCharCreate(Net::MessageIn &msg);
+ static void processCharCreate(Net::MessageIn &msg);
- void processCharCheckRename(Net::MessageIn &msg);
+ static void processCharCheckRename(Net::MessageIn &msg);
- void processCharRename(Net::MessageIn &msg);
+ static void processCharRename(Net::MessageIn &msg);
- void processCharChangeSlot(Net::MessageIn &msg);
+ static void processCharChangeSlot(Net::MessageIn &msg);
private:
- std::string mNewName;
- uint32_t mPinSeed;
- uint32_t mPinAccountId;
- uint32_t mRenameId;
- bool mNeedCreatePin;
+ static std::string mNewName;
+ static uint32_t mPinSeed;
+ static uint32_t mPinAccountId;
+ static uint32_t mRenameId;
+ static bool mNeedCreatePin;
};
} // namespace EAthena
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 8bdd49a11..36fd99a5f 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -479,7 +479,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg)
{
BLOCK_START("CharServerHandler::processCharCreate")
Net::Character *const character = new Net::Character;
- readPlayerData(msg, character, false);
+ charServerHandler->readPlayerData(msg, character, false);
mCharacters.push_back(character);
updateCharSelectDialog();
@@ -497,7 +497,7 @@ void CharServerHandler::processCharCreate2(Net::MessageIn &msg)
{
BLOCK_START("CharServerHandler::processCharCreate2")
Net::Character *const character = new Net::Character;
- readPlayerData(msg, character, true);
+ charServerHandler->readPlayerData(msg, character, true);
mCharacters.push_back(character);
updateCharSelectDialog();
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 38f8ce83b..54ce65c46 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -82,14 +82,14 @@ class CharServerHandler final : public MessageHandler,
void changeSlot(const int oldSlot, const int newSlot) override final;
- protected:
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character,
const bool withColors) const override final;
- void processCharCreate(Net::MessageIn &msg);
+ protected:
+ static void processCharCreate(Net::MessageIn &msg);
- void processCharCreate2(Net::MessageIn &msg);
+ static void processCharCreate2(Net::MessageIn &msg);
};
} // namespace TmwAthena