diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-14 16:40:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-14 16:40:47 +0300 |
commit | b8b4e4c524331b4deb0a6caa8da004430297c98a (patch) | |
tree | a2fd6f1db45e76f08c0e5c1b4e57bbb86efba57b /src/net/eathena | |
parent | c28cd5ffb1ca37a3a6d5ee0a73828dcd092db7f1 (diff) | |
download | manaverse-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.gz manaverse-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.bz2 manaverse-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.xz manaverse-b8b4e4c524331b4deb0a6caa8da004430297c98a.zip |
Replace static members usage from pointers to direct classes.
clang-tidy warning: readability-static-accessed-through-instance
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 8 | ||||
-rw-r--r-- | src/net/eathena/charserverrecv.cpp | 43 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 5 |
4 files changed, 26 insertions, 34 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 95cb677bd..ce2b3a581 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -470,8 +470,8 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) const int num = socialWindow->getPortalIndex(x, y); if (num >= 0) { - dstBeing->setName(keyboard.getKeyShortString( - outfitWindow->keyName(num))); + dstBeing->setName(KeyboardConfig::getKeyShortString( + OutfitWindow::keyName(num))); } else { @@ -927,8 +927,8 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) const int num = socialWindow->getPortalIndex(x, y); if (num >= 0) { - dstBeing->setName(keyboard.getKeyShortString( - outfitWindow->keyName(num))); + dstBeing->setName(KeyboardConfig::getKeyShortString( + OutfitWindow::keyName(num))); } else { diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index 13a374533..487e148bd 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -224,8 +224,8 @@ void CharServerRecv::processCharLogin(Net::MessageIn &msg) msg.skip(20, "unused 0"); - 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 - offset) @@ -235,7 +235,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)", @@ -264,8 +264,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("map ip address"); @@ -283,15 +282,15 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg) } // 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); PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, playerHandler->getDefaultWalkSpeed()); - charServerHandler->mSelectedCharacter->dummy = nullptr; + Net::CharServerHandler::mSelectedCharacter->dummy = nullptr; charServerHandler->clear(); - charServerHandler->updateCharSelectDialog(); + Net::CharServerHandler::updateCharSelectDialog(); if (network != nullptr) network->disconnect(); @@ -304,13 +303,12 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg) Network *const network = Network::mInstance; ServerInfo &server = mapServer; BLOCK_START("CharServerRecv::processChangeMapServer") - const 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) @@ -372,16 +370,13 @@ 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") } @@ -414,7 +409,7 @@ void CharServerRecv::processCharRename(Net::MessageIn &msg) const int flag = msg.readInt16("flag"); if (flag == 0) { - charServerHandler->mCharSelectDialog->setName( + Net::CharServerHandler::mCharSelectDialog->setName( mRenameId, mNewName); CREATEWIDGET(OkDialog, @@ -478,7 +473,7 @@ void CharServerRecv::processCharChangeSlot(Net::MessageIn &msg) void CharServerRecv::processCharDeleteFailed(Net::MessageIn &msg) { BLOCK_START("CharServerRecv::processCharDeleteFailed") - charServerHandler->unlockCharSelectDialog(); + Net::CharServerHandler::unlockCharSelectDialog(); msg.readUInt8("error"); CREATEWIDGET(OkDialog, // TRANSLATORS: error header @@ -530,8 +525,8 @@ void CharServerRecv::processCharCharacters(Net::MessageIn &msg) { msg.skip(2, "packet len"); - 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() - 4) @@ -541,7 +536,7 @@ void CharServerRecv::processCharCharacters(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)", diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 0557c652b..c2aac194b 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -173,12 +173,12 @@ void GeneralHandler::reload() const static_cast<CharServerHandler*>(mCharServerHandler); charHandler->setCharCreateDialog(nullptr); charHandler->setCharSelectDialog(nullptr); - static_cast<PartyHandler*>(mPartyHandler)->reload(); + PartyHandler::reload(); } void GeneralHandler::reloadPartially() const { - static_cast<PartyHandler*>(mPartyHandler)->reload(); + PartyHandler::reload(); } void GeneralHandler::unload() const diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 4c728fb2f..2f5744dec 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -205,10 +205,7 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const outMsg.writeBeingId(id, "object id"); } - EAthena::InventoryHandler *const handler = - static_cast<EAthena::InventoryHandler*>(inventoryHandler); - if (handler != nullptr) - handler->pushPickup(floorItem->getId()); + Ea::InventoryHandler::pushPickup(floorItem->getId()); } void PlayerHandler::setDirection(const unsigned char direction) const |