summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-17 11:14:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-17 11:14:13 +0300
commitdc5766216ee50103909d3b5dcdc5747c149855e0 (patch)
treedb7960089152805498449c0f1b2a392d36543607 /src
parent85c6d5c89ca967020e1a0818c9fa80c065873cc1 (diff)
downloadplus-dc5766216ee50103909d3b5dcdc5747c149855e0.tar.gz
plus-dc5766216ee50103909d3b5dcdc5747c149855e0.tar.bz2
plus-dc5766216ee50103909d3b5dcdc5747c149855e0.tar.xz
plus-dc5766216ee50103909d3b5dcdc5747c149855e0.zip
Remove getter for npcHandler.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp2
-rw-r--r--src/gui/popups/popupmenu.cpp4
-rw-r--r--src/gui/windows/buydialog.cpp2
-rw-r--r--src/gui/windows/buyselldialog.cpp4
-rw-r--r--src/gui/windows/npcdialog.cpp16
-rw-r--r--src/gui/windows/npcpostdialog.cpp5
-rw-r--r--src/gui/windows/selldialog.cpp2
-rw-r--r--src/net/net.cpp6
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/npchandler.h2
10 files changed, 21 insertions, 24 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 1f4845833..6ad8f5a9b 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2310,7 +2310,7 @@ void Being::talkTo() const
if (!PacketLimiter::limitPackets(PACKET_NPC_TALK))
return;
- Net::getNpcHandler()->talk(mId);
+ npcHandler->talk(mId);
}
void Being::draw(Graphics *const graphics,
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 1c4722419..aa5a983fc 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -916,7 +916,7 @@ void PopupMenu::handleLink(const std::string &link,
else if (link == "buy" && being && mBeingId != 0)
{
if (being->getType() == ActorType::Npc)
- Net::getNpcHandler()->buy(mBeingId);
+ npcHandler->buy(mBeingId);
else if (being->getType() == ActorType::Player)
buySellHandler->requestSellList(being->getName());
}
@@ -927,7 +927,7 @@ void PopupMenu::handleLink(const std::string &link,
else if (link == "sell" && being && mBeingId != 0)
{
if (being->getType() == ActorType::Npc)
- Net::getNpcHandler()->sell(mBeingId);
+ npcHandler->sell(mBeingId);
else if (being->getType() == ActorType::Player)
buySellHandler->requestBuyList(being->getName());
}
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index c86ef184a..0bd452c1b 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -440,7 +440,7 @@ void BuyDialog::action(const ActionEvent &event)
else if (mNpcId != -1)
{
const ShopItem *const item = mShopItems->at(selectedItem);
- Net::getNpcHandler()->buyItem(mNpcId, item->getId(),
+ npcHandler->buyItem(mNpcId, item->getId(),
item->getColor(), mAmountItems);
// Update money and adjust the max number of items
diff --git a/src/gui/windows/buyselldialog.cpp b/src/gui/windows/buyselldialog.cpp
index f8d2ec954..701eb96bc 100644
--- a/src/gui/windows/buyselldialog.cpp
+++ b/src/gui/windows/buyselldialog.cpp
@@ -130,14 +130,14 @@ void BuySellDialog::action(const ActionEvent &event)
if (eventId == "Buy")
{
if (mNpcId != -1)
- Net::getNpcHandler()->buy(mNpcId);
+ npcHandler->buy(mNpcId);
else
buySellHandler->requestSellList(mNick);
}
else if (eventId == "Sell")
{
if (mNpcId != -1)
- Net::getNpcHandler()->sell(mNpcId);
+ npcHandler->sell(mNpcId);
else
buySellHandler->requestBuyList(mNick);
}
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 1b11239da..b9917461b 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -318,7 +318,7 @@ void NpcDialog::action(const ActionEvent &event)
selectedIndex + 1);
printText = mItems[selectedIndex];
- Net::getNpcHandler()->listInput(mNpcId, choice);
+ npcHandler->listInput(mNpcId, choice);
break;
}
case NPC_INPUT_STRING:
@@ -326,7 +326,7 @@ void NpcDialog::action(const ActionEvent &event)
if (!PacketLimiter::limitPackets(PACKET_NPC_INPUT))
return;
printText = mTextField->getText();
- Net::getNpcHandler()->stringInput(mNpcId, printText);
+ npcHandler->stringInput(mNpcId, printText);
break;
}
case NPC_INPUT_INTEGER:
@@ -334,7 +334,7 @@ void NpcDialog::action(const ActionEvent &event)
if (!PacketLimiter::limitPackets(PACKET_NPC_INPUT))
return;
printText = strprintf("%d", mIntField->getValue());
- Net::getNpcHandler()->integerInput(
+ npcHandler->integerInput(
mNpcId, mIntField->getValue());
break;
}
@@ -378,7 +378,7 @@ void NpcDialog::action(const ActionEvent &event)
}
// need send selected item
- Net::getNpcHandler()->stringInput(mNpcId, str);
+ npcHandler->stringInput(mNpcId, str);
mInventory->clear();
break;
}
@@ -448,14 +448,14 @@ void NpcDialog::action(const ActionEvent &event)
switch (mInputState)
{
case NPC_INPUT_ITEM:
- Net::getNpcHandler()->stringInput(mNpcId, "0,0");
+ npcHandler->stringInput(mNpcId, "0,0");
break;
case NPC_INPUT_STRING:
case NPC_INPUT_INTEGER:
case NPC_INPUT_NONE:
case NPC_INPUT_LIST:
default:
- Net::getNpcHandler()->listInput(mNpcId, 255);
+ npcHandler->listInput(mNpcId, 255);
break;
}
closeDialog();
@@ -474,13 +474,13 @@ void NpcDialog::action(const ActionEvent &event)
void NpcDialog::nextDialog()
{
- Net::getNpcHandler()->nextDialog(mNpcId);
+ npcHandler->nextDialog(mNpcId);
}
void NpcDialog::closeDialog()
{
restoreCamera();
- Net::getNpcHandler()->closeDialog(mNpcId);
+ npcHandler->closeDialog(mNpcId);
}
int NpcDialog::getNumberOfElements()
diff --git a/src/gui/windows/npcpostdialog.cpp b/src/gui/windows/npcpostdialog.cpp
index 7bca90500..b037c718e 100644
--- a/src/gui/windows/npcpostdialog.cpp
+++ b/src/gui/windows/npcpostdialog.cpp
@@ -119,8 +119,9 @@ void NpcPostDialog::action(const ActionEvent &event)
}
else
{
- Net::getNpcHandler()->sendLetter(mNpcId, mSender->getText(),
- mText->getText());
+ npcHandler->sendLetter(mNpcId,
+ mSender->getText(),
+ mText->getText());
}
setVisible(false);
}
diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp
index b62b22976..fc9ec4b66 100644
--- a/src/gui/windows/selldialog.cpp
+++ b/src/gui/windows/selldialog.cpp
@@ -276,7 +276,7 @@ void SellDialog::action(const ActionEvent &event)
// return the inventory index of the next Duplicate otherwise.
const int itemIndex = item->getCurrentInvIndex();
const int sellCount = item->sellCurrentDuplicate(mAmountItems);
- Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount);
+ npcHandler->sellItem(mNpcId, itemIndex, sellCount);
mAmountItems -= sellCount;
}
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 4e904778c..ee375cfc3 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -53,6 +53,7 @@ namespace Net
class InventoryHandler;
class LoginHandler;
class MailHandler;
+ class NpcHandler;
}
Net::AdminHandler *adminHandler = nullptr;
@@ -78,11 +79,6 @@ Net::CashShopHandler *cashShopHandler = nullptr;
Net::FamilyHandler *familyHandler = nullptr;
Net::BankHandler *bankHandler = nullptr;
-Net::NpcHandler *Net::getNpcHandler()
-{
- return npcHandler;
-}
-
Net::PartyHandler *Net::getPartyHandler()
{
return partyHandler;
diff --git a/src/net/net.h b/src/net/net.h
index b1e6a52ca..e550cfc75 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -36,7 +36,6 @@
namespace Net
{
-class NpcHandler;
class PartyHandler;
class PetHandler;
class PlayerHandler;
@@ -44,7 +43,6 @@ class SkillHandler;
class TradeHandler;
class ServerFeatures;
-NpcHandler *getNpcHandler() A_WARN_UNUSED;
PartyHandler *getPartyHandler() A_WARN_UNUSED;
PetHandler *getPetHandler() A_WARN_UNUSED;
PlayerHandler *getPlayerHandler() A_WARN_UNUSED;
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index 9dfc7dbbc..706f6d7c3 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -93,4 +93,6 @@ class NpcHandler notfinal
} // namespace Net
+extern Net::NpcHandler *npcHandler;
+
#endif // NET_NPCHANDLER_H