summaryrefslogtreecommitdiff
path: root/src/net/tmwa/npchandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-01 01:13:14 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-01 01:13:14 +0300
commit24902ba328260cb496c62e236a644ebb990e3fd4 (patch)
treefd9ee8f2759566f29076eb63689802b40fe13756 /src/net/tmwa/npchandler.cpp
parent2c273a20b2cd3e1628840f2d87df16f0cce9ad33 (diff)
downloadplus-24902ba328260cb496c62e236a644ebb990e3fd4.tar.gz
plus-24902ba328260cb496c62e236a644ebb990e3fd4.tar.bz2
plus-24902ba328260cb496c62e236a644ebb990e3fd4.tar.xz
plus-24902ba328260cb496c62e236a644ebb990e3fd4.zip
Store interacted npc type before buy or talk and send it to buy dialog.
Diffstat (limited to 'src/net/tmwa/npchandler.cpp')
-rw-r--r--src/net/tmwa/npchandler.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 2db9527a3..b892e152a 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -50,10 +50,12 @@ NpcHandler::NpcHandler() :
npcHandler = this;
}
-void NpcHandler::talk(const BeingId npcId) const
+void NpcHandler::talk(const Being *const being) const
{
+ if (!being)
+ return;
createOutPacket(CMSG_NPC_TALK);
- outMsg.writeBeingId(npcId, "npc id");
+ outMsg.writeBeingId(being->getId(), "npc id");
outMsg.writeInt8(0, "unused");
}
@@ -106,10 +108,12 @@ void NpcHandler::stringInput(const BeingId npcId,
outMsg.writeInt8(0, "null byte");
}
-void NpcHandler::buy(const BeingId beingId) const
+void NpcHandler::buy(const Being *const being) const
{
+ if (!being)
+ return;
createOutPacket(CMSG_NPC_BUY_SELL_REQUEST);
- outMsg.writeBeingId(beingId, "npc id");
+ outMsg.writeBeingId(being->getId(), "npc id");
outMsg.writeInt8(0, "action");
}