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 | |
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')
-rw-r--r-- | src/net/ea/charserverrecv.cpp | 16 | ||||
-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 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/charserverrecv.cpp | 35 | ||||
-rw-r--r-- | src/net/tmwa/chatrecv.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/guildmanager.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 5 |
11 files changed, 56 insertions, 72 deletions
diff --git a/src/net/ea/charserverrecv.cpp b/src/net/ea/charserverrecv.cpp index 7f27a6d2e..d058dfe6d 100644 --- a/src/net/ea/charserverrecv.cpp +++ b/src/net/ea/charserverrecv.cpp @@ -111,20 +111,20 @@ void CharServerRecv::processCharCreateFailed(Net::MessageIn &msg) ShowCenter_true, nullptr, 260); - if (charServerHandler->mCharCreateDialog != nullptr) - charServerHandler->mCharCreateDialog->unlock(); + if (Net::CharServerHandler::mCharCreateDialog != nullptr) + Net::CharServerHandler::mCharCreateDialog->unlock(); BLOCK_END("CharServerRecv::processCharCreateFailed") } void CharServerRecv::processCharDelete(Net::MessageIn &msg A_UNUSED) { BLOCK_START("CharServerRecv::processCharDelete") - delete charServerHandler->mSelectedCharacter; - charServerHandler->mCharacters.remove( - charServerHandler->mSelectedCharacter); - charServerHandler->mSelectedCharacter = nullptr; - charServerHandler->updateCharSelectDialog(); - charServerHandler->unlockCharSelectDialog(); + delete Net::CharServerHandler::mSelectedCharacter; + Net::CharServerHandler::mCharacters.remove( + Net::CharServerHandler::mSelectedCharacter); + Net::CharServerHandler::mSelectedCharacter = nullptr; + Net::CharServerHandler::updateCharSelectDialog(); + Net::CharServerHandler::unlockCharSelectDialog(); CREATEWIDGET(OkDialog, // TRANSLATORS: info message header _("Info"), 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 diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index 40b5630ef..7b37d1438 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -896,8 +896,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 { 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 diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index 62150a2ad..d0ac861df 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -237,7 +237,7 @@ void ChatRecv::processWhisperContinue(const std::string &nick, if (showMsg && (chatWindow != nullptr)) chatWindow->addWhisper(nick, chatMsg); if (chatMsg.find("B1") == 0 || chatMsg.find("S1") == 0) - shopWindow->showList(nick, chatMsg); + ShopWindow::showList(nick, chatMsg); } else if (chatWindow != nullptr) { diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 6546bf23a..0cbaf1c4c 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/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/tmwa/guildmanager.cpp b/src/net/tmwa/guildmanager.cpp index d3670cdac..168f4cdea 100644 --- a/src/net/tmwa/guildmanager.cpp +++ b/src/net/tmwa/guildmanager.cpp @@ -74,7 +74,7 @@ void GuildManager::init() int val = serverConfig.getValue("enableGuildBot", -1); if (val == -1) { - if (client->isTmw()) + if (Client::isTmw()) val = 1; else val = 0; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 70139cd4a..e1d55d47d 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -107,10 +107,7 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const createOutPacket(CMSG_ITEM_PICKUP); outMsg.writeBeingId(floorItem->getId(), "object id"); - TmwAthena::InventoryHandler *const handler = - static_cast<TmwAthena::InventoryHandler*>(inventoryHandler); - if (handler != nullptr) - handler->pushPickup(floorItem->getId()); + Ea::InventoryHandler::pushPickup(floorItem->getId()); } void PlayerHandler::setDirection(const unsigned char direction) const |