summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-17 00:49:45 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-17 00:49:45 +0300
commit1307b14ff24f3935fa58aef405ffb246c0741336 (patch)
treebe0ebcda4a9b99a3b290fca9d8a210b18400b73a /src
parentb10cb3ac1189eaa5f41184527eee342584231f84 (diff)
downloadmanaplus-1307b14ff24f3935fa58aef405ffb246c0741336.tar.gz
manaplus-1307b14ff24f3935fa58aef405ffb246c0741336.tar.bz2
manaplus-1307b14ff24f3935fa58aef405ffb246c0741336.tar.xz
manaplus-1307b14ff24f3935fa58aef405ffb246c0741336.zip
Remove getter for charServerHandler.
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp2
-rw-r--r--src/being/being.cpp14
-rw-r--r--src/client.cpp2
-rw-r--r--src/gui/windows/charcreatedialog.cpp8
-rw-r--r--src/gui/windows/charselectdialog.cpp12
-rw-r--r--src/gui/windows/logindialog.cpp2
-rw-r--r--src/gui/windows/quitdialog.cpp2
-rw-r--r--src/listeners/pincodelistener.cpp2
-rw-r--r--src/net/charserverhandler.h2
-rw-r--r--src/net/eathena/charserverhandler.cpp2
-rw-r--r--src/net/net.cpp6
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/tmwa/charserverhandler.cpp2
13 files changed, 27 insertions, 31 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 9827e1485..a42e466bc 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1744,7 +1744,7 @@ Being *ActorManager::cloneBeing(const Being *const srcBeing,
const unsigned char color = srcBeing->getSpriteColor(slot);
dstBeing->setSprite(slot, spriteId, "", color, false);
}
- const int hairSlot = Net::getCharServerHandler()->hairSprite();
+ const int hairSlot = charServerHandler->hairSprite();
const int hairStyle = -srcBeing->getSpriteID(hairSlot);
const unsigned char hairColor = srcBeing->getHairColor();
dstBeing->setSprite(hairSlot, hairStyle * -1,
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 68420f742..02d235e8d 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -345,16 +345,16 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
id = -100;
// TRANSLATORS: default race name
setRaceName(_("Human"));
- if (Net::getCharServerHandler())
- setSprite(Net::getCharServerHandler()->baseSprite(), id);
+ if (charServerHandler)
+ setSprite(charServerHandler->baseSprite(), id);
}
else
{
const ItemInfo &info = ItemDB::get(id);
setRaceName(info.getName());
- if (Net::getCharServerHandler())
+ if (charServerHandler)
{
- setSprite(Net::getCharServerHandler()->baseSprite(),
+ setSprite(charServerHandler->baseSprite(),
id, info.getColor(mLook));
}
}
@@ -1972,7 +1972,7 @@ void Being::updateSprite(const unsigned int slot, const int id,
std::string color, const unsigned char colorId,
const bool isWeapon, const bool isTempSprite)
{
- if (slot >= Net::getCharServerHandler()->maxSprite())
+ if (slot >= charServerHandler->maxSprite())
return;
if (slot >= static_cast<unsigned int>(mSpriteIDs.size()))
@@ -1987,7 +1987,7 @@ void Being::setSprite(const unsigned int slot, const int id,
std::string color, const unsigned char colorId,
const bool isWeapon, const bool isTempSprite)
{
- if (slot >= Net::getCharServerHandler()->maxSprite())
+ if (slot >= charServerHandler->maxSprite())
return;
if (slot >= static_cast<unsigned int>(size()))
@@ -2553,7 +2553,7 @@ void Being::recalcSpritesOrder()
if (mAction == BeingAction::DEAD)
dir = 9;
- const unsigned int hairSlot = Net::getCharServerHandler()->hairSprite();
+ const unsigned int hairSlot = charServerHandler->hairSprite();
for (size_t slot = 0; slot < sz; slot ++)
{
diff --git a/src/client.cpp b/src/client.cpp
index f5268f6c8..40466638c 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1275,7 +1275,7 @@ int Client::gameExec()
_("Requesting characters"),
STATE_SWITCH_SERVER);
mCurrentDialog->postInit();
- Net::getCharServerHandler()->requestCharacters();
+ charServerHandler->requestCharacters();
BLOCK_END("Client::gameExec STATE_GET_CHARACTERS")
break;
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 7454eee73..1ee09a5d8 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -335,8 +335,8 @@ CharCreateDialog::~CharCreateDialog()
{
delete2(mPlayer);
- if (Net::getCharServerHandler())
- Net::getCharServerHandler()->setCharCreateDialog(nullptr);
+ if (charServerHandler)
+ charServerHandler->setCharCreateDialog(nullptr);
}
void CharCreateDialog::action(const ActionEvent &event)
@@ -358,7 +358,7 @@ void CharCreateDialog::action(const ActionEvent &event)
const int characterSlot = mSlot;
- Net::getCharServerHandler()->newCharacter(getName(), characterSlot,
+ charServerHandler->newCharacter(getName(), characterSlot,
mFemale->isSelected(), mHairStyle, mHairColor,
static_cast<unsigned char>(mRace),
static_cast<unsigned char>(mLook), atts);
@@ -620,7 +620,7 @@ void CharCreateDialog::updateHair()
mHairColorNameLabel->setCaption(ColorDB::getHairColorName(mHairColor));
mHairColorNameLabel->resizeTo(150, 150);
- mPlayer->setSprite(Net::getCharServerHandler()->hairSprite(),
+ mPlayer->setSprite(charServerHandler->hairSprite(),
mHairStyle * -1, item.getDyeColorsString(mHairColor));
}
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 3c355c199..95b3d6cfc 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -83,7 +83,7 @@ CharSelectDialog::CharSelectDialog(LoginData *const data) :
mDeleteButton(new Button(this, _("Delete"), "delete", this)),
mCharacterView(nullptr),
mCharacterEntries(0),
- mCharServerHandler(Net::getCharServerHandler()),
+ mCharServerHandler(charServerHandler),
mDeleteDialog(nullptr),
mDeleteIndex(-1),
mLocked(false),
@@ -166,21 +166,21 @@ CharSelectDialog::CharSelectDialog(LoginData *const data) :
addKeyListener(this);
center();
- Net::getCharServerHandler()->setCharSelectDialog(this);
+ charServerHandler->setCharSelectDialog(this);
mCharacterView->show(0);
updateState();
}
CharSelectDialog::~CharSelectDialog()
{
- Net::getCharServerHandler()->clear();
+ charServerHandler->clear();
}
void CharSelectDialog::postInit()
{
setVisible(true);
requestFocus();
- if (Net::getCharServerHandler()->isNeedCreatePin())
+ if (charServerHandler->isNeedCreatePin())
{
EditDialog *const dialog = new EditDialog(
_("Please set new pincode"), "", "OK");
@@ -261,7 +261,7 @@ void CharSelectDialog::action(const ActionEvent &event)
}
if (eventId == "switch")
{
- Net::getCharServerHandler()->clear();
+ charServerHandler->clear();
close();
}
else if (eventId == "change_password")
@@ -274,7 +274,7 @@ void CharSelectDialog::action(const ActionEvent &event)
}
else if (eventId == "unregister")
{
- Net::getCharServerHandler()->clear();
+ charServerHandler->clear();
client->setState(STATE_UNREGISTER);
}
else if (eventId == "try delete character")
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 510470ada..ffcbc8c69 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -97,7 +97,7 @@ LoginDialog::LoginDialog(LoginData *const data,
setCloseButton(true);
setWindowName("Login");
- Net::getCharServerHandler()->clear();
+ charServerHandler->clear();
// TRANSLATORS: login dialog label
Label *const serverLabel1 = new Label(this, _("Server:"));
diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp
index 9635cd98f..2f9cf51c5 100644
--- a/src/gui/windows/quitdialog.cpp
+++ b/src/gui/windows/quitdialog.cpp
@@ -193,7 +193,7 @@ void QuitDialog::action(const ActionEvent &event)
{
if (client->getState() == STATE_GAME)
{
- Net::getCharServerHandler()->switchCharacter();
+ charServerHandler->switchCharacter();
DialogsManager::closeDialogs();
serverConfig.write();
}
diff --git a/src/listeners/pincodelistener.cpp b/src/listeners/pincodelistener.cpp
index 8938d0a8a..12b1e98e2 100644
--- a/src/listeners/pincodelistener.cpp
+++ b/src/listeners/pincodelistener.cpp
@@ -36,6 +36,6 @@ void PincodeListener::action(const ActionEvent &event)
if (dialog)
{
const std::string pincode = dialog->getMsg();
- Net::getCharServerHandler()->setNewPincode(pincode);
+ charServerHandler->setNewPincode(pincode);
}
}
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index df3d806a0..2ad06901d 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -100,4 +100,6 @@ class CharServerHandler notfinal
} // namespace Net
+extern Net::CharServerHandler *charServerHandler;
+
#endif // NET_CHARSERVERHANDLER_H
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index f94ae5838..e1d6c5373 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -376,7 +376,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg)
mSelectedCharacter->dummy = nullptr;
- Net::getCharServerHandler()->clear();
+ charServerHandler->clear();
updateCharSelectDialog();
if (network)
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 2330e8d5f..f4736a01c 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -44,6 +44,7 @@ namespace Net
class BeingHandler;
class BuySellHandler;
class CashShopHandler;
+ class CharServerHandler;
}
Net::AdminHandler *adminHandler = nullptr;
@@ -69,11 +70,6 @@ Net::CashShopHandler *cashShopHandler = nullptr;
Net::FamilyHandler *familyHandler = nullptr;
Net::BankHandler *bankHandler = nullptr;
-Net::CharServerHandler *Net::getCharServerHandler()
-{
- return charServerHandler;
-}
-
Net::ChatHandler *Net::getChatHandler()
{
return chatHandler;
diff --git a/src/net/net.h b/src/net/net.h
index f6029211c..56c091924 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -36,7 +36,6 @@
namespace Net
{
-class CharServerHandler;
class ChatHandler;
class FamilyHandler;
class GameHandler;
@@ -53,7 +52,6 @@ class SkillHandler;
class TradeHandler;
class ServerFeatures;
-CharServerHandler *getCharServerHandler() A_WARN_UNUSED;
ChatHandler *getChatHandler() A_WARN_UNUSED;
GameHandler *getGameHandler() A_WARN_UNUSED;
GeneralHandler *getGeneralHandler() A_WARN_UNUSED;
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 132fd0cea..e23b6f08c 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -439,7 +439,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg)
mSelectedCharacter->dummy = nullptr;
- Net::getCharServerHandler()->clear();
+ charServerHandler->clear();
updateCharSelectDialog();
if (network)