From ab3b909187ee0a18946bff50a6bd3e8e281970f1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 22 Sep 2015 21:44:22 +0300 Subject: Remove checking packet id in getNpc function. --- src/net/tmwa/npchandler.cpp | 16 ++++------------ src/net/tmwa/npchandler.h | 3 ++- 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 351cb2d7a..f742ecb38 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -31,7 +31,6 @@ #include "net/messagein.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocolin.h" #include "net/tmwa/protocolout.h" #include "net/ea/eaprotocol.h" @@ -180,16 +179,9 @@ void NpcHandler::selectAutoSpell(const int skillId A_UNUSED) const { } -BeingId NpcHandler::getNpc(Net::MessageIn &msg) +BeingId NpcHandler::getNpc(Net::MessageIn &msg, + const NpcAction action) { - // +++ must be removed packet id checks from here - if (msg.getId() == SMSG_NPC_CHOICE - || msg.getId() == SMSG_NPC_MESSAGE - || msg.getId() == SMSG_NPC_CHANGETITLE) - { - msg.readInt16("len"); - } - const BeingId npcId = msg.readBeingId("npc id"); const NpcDialogs::const_iterator diag = NpcDialog::mNpcDialogs.find(npcId); @@ -199,12 +191,12 @@ BeingId NpcHandler::getNpc(Net::MessageIn &msg) { // +++ must be removed packet id checks from here // Empty dialogs don't help - if (msg.getId() == SMSG_NPC_CLOSE) + if (action == NpcAction::Close) { closeDialog(npcId); return npcId; } - else if (msg.getId() == SMSG_NPC_NEXT) + else if (action == NpcAction::Next) { nextDialog(npcId); return npcId; diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index a69845724..51402768c 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -65,7 +65,8 @@ class NpcHandler final : public Ea::NpcHandler void completeProgressBar() const override final; - BeingId getNpc(Net::MessageIn &msg) override final; + BeingId getNpc(Net::MessageIn &msg, + const NpcAction action) override final; void produceMix(const int nameId, const int materialId1, -- cgit v1.2.3-60-g2f50