summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-16 22:35:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-16 22:35:17 +0300
commitb3d17866a3c5700b52c2b0b954fce132a52c1dbf (patch)
tree7ba07c98a1842eb766de35e172f559dcf5ac6fb4 /src/net
parent5e8e53f6e795a84ab5ca6cfe0d08672878044707 (diff)
downloadplus-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.tar.gz
plus-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.tar.bz2
plus-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.tar.xz
plus-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.zip
Convert State enum into strong typed.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/charserverrecv.cpp2
-rw-r--r--src/net/ea/gamerecv.cpp2
-rw-r--r--src/net/ea/loginhandler.cpp4
-rw-r--r--src/net/ea/loginrecv.cpp4
-rw-r--r--src/net/eathena/charserverrecv.cpp8
-rw-r--r--src/net/eathena/gamehandler.cpp2
-rw-r--r--src/net/eathena/gamerecv.cpp2
-rw-r--r--src/net/eathena/generalhandler.cpp2
-rw-r--r--src/net/eathena/generalrecv.cpp6
-rw-r--r--src/net/eathena/loginhandler.cpp4
-rw-r--r--src/net/eathena/loginrecv.cpp12
-rw-r--r--src/net/tmwa/charserverrecv.cpp6
-rw-r--r--src/net/tmwa/gamehandler.cpp2
-rw-r--r--src/net/tmwa/gamerecv.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp2
-rw-r--r--src/net/tmwa/generalrecv.cpp4
-rw-r--r--src/net/tmwa/loginrecv.cpp8
17 files changed, 36 insertions, 36 deletions
diff --git a/src/net/ea/charserverrecv.cpp b/src/net/ea/charserverrecv.cpp
index 7b04c05b0..e3b0a0ffd 100644
--- a/src/net/ea/charserverrecv.cpp
+++ b/src/net/ea/charserverrecv.cpp
@@ -59,7 +59,7 @@ void CharServerRecv::processCharLoginError(Net::MessageIn &msg)
errorMessage = _("Unknown char-server failure.");
break;
}
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
BLOCK_END("CharServerRecv::processCharLoginError")
}
diff --git a/src/net/ea/gamerecv.cpp b/src/net/ea/gamerecv.cpp
index 3a85e54a9..8689345e9 100644
--- a/src/net/ea/gamerecv.cpp
+++ b/src/net/ea/gamerecv.cpp
@@ -55,7 +55,7 @@ void GameRecv::processWhoAnswer(Net::MessageIn &msg)
void GameRecv::processCharSwitchResponse(Net::MessageIn &msg)
{
if (msg.readUInt8("response"))
- client->setState(STATE_SWITCH_CHARACTER);
+ client->setState(State::SWITCH_CHARACTER);
}
void GameRecv::processMapQuitResponse(Net::MessageIn &msg)
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index bf3621c53..581cb6713 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -61,7 +61,7 @@ bool LoginHandler::isRegistrationEnabled() const
void LoginHandler::getRegistrationDetails() const
{
// Not supported, so move on
- client->setState(STATE_REGISTER);
+ client->setState(State::REGISTER);
}
void LoginHandler::loginAccount(LoginData *const loginData1) const
@@ -97,7 +97,7 @@ void LoginHandler::chooseServer(const unsigned int server,
charServer->port = LoginRecv::mWorlds[server]->port;
}
- client->setState(STATE_UPDATE);
+ client->setState(State::UPDATE);
}
void LoginHandler::registerAccount(const LoginData *const loginData1) const
diff --git a/src/net/ea/loginrecv.cpp b/src/net/ea/loginrecv.cpp
index 37cc96b8b..7a0cff90b 100644
--- a/src/net/ea/loginrecv.cpp
+++ b/src/net/ea/loginrecv.cpp
@@ -103,7 +103,7 @@ void LoginRecv::processLoginData(Net::MessageIn &msg)
mWorlds.push_back(world);
}
- client->setState(STATE_WORLD_SELECT);
+ client->setState(State::WORLD_SELECT);
}
void LoginRecv::processLoginError(Net::MessageIn &msg)
@@ -171,7 +171,7 @@ void LoginRecv::processLoginError(Net::MessageIn &msg)
errorMessage = _("Unknown error.");
break;
}
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
} // namespace Ea
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index aed472207..d09d98768 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -200,7 +200,7 @@ void CharServerRecv::processCharLogin(Net::MessageIn &msg)
}
}
- client->setState(STATE_CHAR_SELECT);
+ client->setState(State::CHAR_SELECT);
}
void CharServerRecv::processCharLogin2(Net::MessageIn &msg)
@@ -247,7 +247,7 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg)
if (network)
network->disconnect();
- client->setState(STATE_CONNECT_GAME);
+ client->setState(State::CONNECT_GAME);
BLOCK_END("CharServerRecv::processCharMapInfo")
}
@@ -277,7 +277,7 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg)
server.port = msg.readInt16("port");
network->disconnect();
- client->setState(STATE_CHANGE_MAP);
+ client->setState(State::CHANGE_MAP);
if (localPlayer)
{
localPlayer->setTileCoords(x, y);
@@ -499,7 +499,7 @@ void CharServerRecv::processCharCharacters(Net::MessageIn &msg)
}
}
- client->setState(STATE_CHAR_SELECT);
+ client->setState(State::CHAR_SELECT);
}
void CharServerRecv::processCharBanCharList(Net::MessageIn &msg)
diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp
index 1b5b1bc3a..0fa7a44fe 100644
--- a/src/net/eathena/gamehandler.cpp
+++ b/src/net/eathena/gamehandler.cpp
@@ -67,7 +67,7 @@ void GameHandler::connect()
const Token &token = static_cast<LoginHandler*>(loginHandler)->getToken();
- if (client->getState() == STATE_CONNECT_GAME)
+ if (client->getState() == State::CONNECT_GAME)
{
// Change the player's ID to the account ID to match what eAthena uses
if (localPlayer)
diff --git a/src/net/eathena/gamerecv.cpp b/src/net/eathena/gamerecv.cpp
index 43c52ba61..e7dd0b589 100644
--- a/src/net/eathena/gamerecv.cpp
+++ b/src/net/eathena/gamerecv.cpp
@@ -65,7 +65,7 @@ void GameRecv::processMapLogin(Net::MessageIn &msg)
network->pauseDispatch();
// Switch now or we'll have problems
- client->setState(STATE_GAME);
+ client->setState(State::GAME);
if (localPlayer)
localPlayer->setTileCoords(x, y);
}
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index ecfa7eeda..7ee608088 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -186,7 +186,7 @@ void GeneralHandler::flushNetwork()
else
errorMessage = _("Got disconnected from server!");
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
}
diff --git a/src/net/eathena/generalrecv.cpp b/src/net/eathena/generalrecv.cpp
index ff5809028..6e6ece029 100644
--- a/src/net/eathena/generalrecv.cpp
+++ b/src/net/eathena/generalrecv.cpp
@@ -51,7 +51,7 @@ void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
errorMessage = _("No servers available.");
break;
case 2:
- if (client->getState() == STATE_GAME)
+ if (client->getState() == State::GAME)
{
errorMessage = _("Someone else is trying to use "
"this account.");
@@ -136,7 +136,7 @@ void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
errorMessage = _("Unknown connection error.");
break;
}
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
void GeneralRecv::processMapNotFound(Net::MessageIn &msg)
@@ -144,7 +144,7 @@ void GeneralRecv::processMapNotFound(Net::MessageIn &msg)
const int sz = msg.readInt16("len") - 4;
msg.readString(sz, "map name?");
errorMessage = _("Map not found");
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
} // namespace EAthena
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index a50b0dc4a..07314cf64 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -62,8 +62,8 @@ void LoginHandler::connect()
}
else
{
- if (client->getState() != STATE_LOGIN)
- client->setState(STATE_LOGIN);
+ if (client->getState() != State::LOGIN)
+ client->setState(State::LOGIN);
}
}
diff --git a/src/net/eathena/loginrecv.cpp b/src/net/eathena/loginrecv.cpp
index af9592b7a..6324689b5 100644
--- a/src/net/eathena/loginrecv.cpp
+++ b/src/net/eathena/loginrecv.cpp
@@ -117,7 +117,7 @@ void LoginRecv::processLoginError2(Net::MessageIn &msg)
UNIMPLIMENTEDPACKET;
break;
}
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
void LoginRecv::processUpdateHost2(Net::MessageIn &msg)
@@ -139,8 +139,8 @@ void LoginRecv::processUpdateHost2(Net::MessageIn &msg)
logger->log("Received update hosts \"%s\" from login server.",
updateHost.c_str());
- if (client->getState() == STATE_PRE_LOGIN)
- client->setState(STATE_LOGIN);
+ if (client->getState() == State::PRE_LOGIN)
+ client->setState(State::LOGIN);
}
void LoginRecv::processServerVersion(Net::MessageIn &msg)
@@ -167,7 +167,7 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg)
logger->log("Hercules without version");
}
updateProtocol();
- client->setState(STATE_LOGIN);
+ client->setState(State::LOGIN);
}
void LoginRecv::processCondingKey(Net::MessageIn &msg)
@@ -184,7 +184,7 @@ void LoginRecv::processCharPasswordResponse(Net::MessageIn &msg)
// Successful pass change
if (errMsg == 1)
{
- client->setState(STATE_CHANGEPASSWORD_SUCCESS);
+ client->setState(State::CHANGEPASSWORD_SUCCESS);
}
// pass change failed
else
@@ -209,7 +209,7 @@ void LoginRecv::processCharPasswordResponse(Net::MessageIn &msg)
errorMessage = _("Unknown error.");
break;
}
- client->setState(STATE_ACCOUNTCHANGE_ERROR);
+ client->setState(State::ACCOUNTCHANGE_ERROR);
}
}
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp
index f2e1b0943..6c47f5e05 100644
--- a/src/net/tmwa/charserverrecv.cpp
+++ b/src/net/tmwa/charserverrecv.cpp
@@ -177,7 +177,7 @@ void CharServerRecv::processCharLogin(Net::MessageIn &msg)
}
}
- client->setState(STATE_CHAR_SELECT);
+ client->setState(State::CHAR_SELECT);
BLOCK_END("CharServerRecv::processCharLogin")
}
@@ -211,7 +211,7 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg)
if (network)
network->disconnect();
- client->setState(STATE_CONNECT_GAME);
+ client->setState(State::CONNECT_GAME);
BLOCK_END("CharServerRecv::processCharMapInfo")
}
@@ -241,7 +241,7 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg)
server.port = msg.readInt16("port");
network->disconnect();
- client->setState(STATE_CHANGE_MAP);
+ client->setState(State::CHANGE_MAP);
if (localPlayer)
{
localPlayer->setTileCoords(x, y);
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 7a8628df5..3b6e9bd7e 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -64,7 +64,7 @@ void GameHandler::connect()
Network::mInstance->connect(mapServer);
const Token &token = static_cast<LoginHandler*>(loginHandler)->getToken();
- if (client->getState() == STATE_CONNECT_GAME)
+ if (client->getState() == State::CONNECT_GAME)
{
// Change the player's ID to the account ID to match what eAthena uses
if (localPlayer)
diff --git a/src/net/tmwa/gamerecv.cpp b/src/net/tmwa/gamerecv.cpp
index ba68d9391..f6db8b616 100644
--- a/src/net/tmwa/gamerecv.cpp
+++ b/src/net/tmwa/gamerecv.cpp
@@ -55,7 +55,7 @@ void GameRecv::processMapLogin(Net::MessageIn &msg)
network->pauseDispatch();
// Switch now or we'll have problems
- client->setState(STATE_GAME);
+ client->setState(State::GAME);
if (localPlayer)
localPlayer->setTileCoords(x, y);
}
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 818e2d7a2..8dfdccfbc 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -207,7 +207,7 @@ void GeneralHandler::flushNetwork()
errorMessage = _("Got disconnected from server!");
}
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
BLOCK_END("GeneralHandler::flushNetwork 3")
}
diff --git a/src/net/tmwa/generalrecv.cpp b/src/net/tmwa/generalrecv.cpp
index 42fc75350..9a87f1446 100644
--- a/src/net/tmwa/generalrecv.cpp
+++ b/src/net/tmwa/generalrecv.cpp
@@ -53,7 +53,7 @@ void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
errorMessage = _("No servers available.");
break;
case 2:
- if (client->getState() == STATE_GAME)
+ if (client->getState() == State::GAME)
{
// TRANSLATORS: error message
errorMessage = _("Someone else is trying to use this "
@@ -78,7 +78,7 @@ void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
errorMessage = _("Unknown connection error.");
break;
}
- client->setState(STATE_ERROR);
+ client->setState(State::ERROR);
}
} // namespace TmwAthena
diff --git a/src/net/tmwa/loginrecv.cpp b/src/net/tmwa/loginrecv.cpp
index c6aa48b83..783e5d55c 100644
--- a/src/net/tmwa/loginrecv.cpp
+++ b/src/net/tmwa/loginrecv.cpp
@@ -86,8 +86,8 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg)
if (serverVersion < 5)
{
- if (client->getState() != STATE_LOGIN)
- client->setState(STATE_LOGIN);
+ if (client->getState() != State::LOGIN)
+ client->setState(State::LOGIN);
}
// Leave this last
@@ -101,7 +101,7 @@ void LoginRecv::processCharPasswordResponse(Net::MessageIn &msg)
// Successful pass change
if (errMsg == 1)
{
- client->setState(STATE_CHANGEPASSWORD_SUCCESS);
+ client->setState(State::CHANGEPASSWORD_SUCCESS);
}
// pass change failed
else
@@ -126,7 +126,7 @@ void LoginRecv::processCharPasswordResponse(Net::MessageIn &msg)
errorMessage = _("Unknown error.");
break;
}
- client->setState(STATE_ACCOUNTCHANGE_ERROR);
+ client->setState(State::ACCOUNTCHANGE_ERROR);
}
}