summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-14 16:40:47 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-14 16:40:47 +0300
commitb8b4e4c524331b4deb0a6caa8da004430297c98a (patch)
treea2fd6f1db45e76f08c0e5c1b4e57bbb86efba57b /src/net/tmwa
parentc28cd5ffb1ca37a3a6d5ee0a73828dcd092db7f1 (diff)
downloadplus-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.gz
plus-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.bz2
plus-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.xz
plus-b8b4e4c524331b4deb0a6caa8da004430297c98a.zip
Replace static members usage from pointers to direct classes.
clang-tidy warning: readability-static-accessed-through-instance
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beingrecv.cpp4
-rw-r--r--src/net/tmwa/charserverrecv.cpp35
-rw-r--r--src/net/tmwa/chatrecv.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp4
-rw-r--r--src/net/tmwa/guildmanager.cpp2
-rw-r--r--src/net/tmwa/playerhandler.cpp5
6 files changed, 22 insertions, 30 deletions
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