diff options
Diffstat (limited to 'src/net/tmwa/charserverrecv.cpp')
-rw-r--r-- | src/net/tmwa/charserverrecv.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 0130960e0..0f16effa9 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -180,8 +180,8 @@ void CharServerRecv::processCharLogin(Net::MessageIn &msg) msg.skip(18, "unused"); - delete_all(charServerHandler->mCharacters); - charServerHandler->mCharacters.clear(); + delete_all(Net::CharServerHandler::mCharacters); + Net::CharServerHandler::mCharacters.clear(); // Derive number of characters from message length const int count = (msg.getLength() - 24) / 106; @@ -190,7 +190,7 @@ void CharServerRecv::processCharLogin(Net::MessageIn &msg) { Net::Character *const character = new Net::Character; readPlayerData(msg, character); - charServerHandler->mCharacters.push_back(character); + Net::CharServerHandler::mCharacters.push_back(character); if (character->dummy != nullptr) { logger->log("CharServer: Player: %s (%d)", @@ -208,8 +208,7 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg) ServerInfo &server = mapServer; BLOCK_START("CharServerRecv::processCharMapInfo") PlayerInfo::setCharId(msg.readInt32("char id?")); - const GameHandler *const gh = static_cast<GameHandler*>(gameHandler); - gh->setMap(msg.readString(16, "map name")); + GameHandler::setMap(msg.readString(16, "map name")); if (config.getBoolValue("usePersistentIP") || settings.persistentIp) { msg.readInt32("ip address"); @@ -222,13 +221,13 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg) server.port = msg.readInt16("port"); // Prevent the selected local player from being deleted - localPlayer = charServerHandler->mSelectedCharacter->dummy; - PlayerInfo::setBackend(charServerHandler->mSelectedCharacter->data); + localPlayer = Net::CharServerHandler::mSelectedCharacter->dummy; + PlayerInfo::setBackend(Net::CharServerHandler::mSelectedCharacter->data); - charServerHandler->mSelectedCharacter->dummy = nullptr; + Net::CharServerHandler::mSelectedCharacter->dummy = nullptr; charServerHandler->clear(); - charServerHandler->updateCharSelectDialog(); + Net::CharServerHandler::updateCharSelectDialog(); if (network != nullptr) network->disconnect(); @@ -241,13 +240,12 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg) Network *const network = Network::mInstance; ServerInfo &server = mapServer; BLOCK_START("CharServerRecv::processChangeMapServer") - GameHandler *const gh = static_cast<GameHandler*>(gameHandler); - if ((gh == nullptr) || (network == nullptr)) + if (network == nullptr) { BLOCK_END("CharServerRecv::processChangeMapServer") return; } - gh->setMap(msg.readString(16, "map name")); + GameHandler::setMap(msg.readString(16, "map name")); const int x = msg.readInt16("x"); const int y = msg.readInt16("y"); if (config.getBoolValue("usePersistentIP") || settings.persistentIp) @@ -276,23 +274,20 @@ void CharServerRecv::processCharCreate(Net::MessageIn &msg) BLOCK_START("CharServerRecv::processCharCreate") Net::Character *const character = new Net::Character; readPlayerData(msg, character); - charServerHandler->mCharacters.push_back(character); + Net::CharServerHandler::mCharacters.push_back(character); - charServerHandler->updateCharSelectDialog(); + Net::CharServerHandler::updateCharSelectDialog(); // Close the character create dialog - if (charServerHandler->mCharCreateDialog != nullptr) - { - charServerHandler->mCharCreateDialog->scheduleDelete(); - charServerHandler->mCharCreateDialog = nullptr; - } + Net::CharServerHandler::mCharCreateDialog->scheduleDelete(); + Net::CharServerHandler::mCharCreateDialog = nullptr; BLOCK_END("CharServerRecv::processCharCreate") } void CharServerRecv::processCharDeleteFailed(Net::MessageIn &msg) { BLOCK_START("CharServerRecv::processCharDeleteFailed") - charServerHandler->unlockCharSelectDialog(); + Net::CharServerHandler::unlockCharSelectDialog(); msg.readUInt8("error"); CREATEWIDGET(OkDialog, // TRANSLATORS: error header |