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/eathena/npchandler.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/net/eathena/npchandler.cpp') diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 74474b08f..97b1c28dc 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -34,7 +34,6 @@ #include "net/ea/npcrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocolin.h" #include "net/eathena/protocolout.h" #include "debug.h" @@ -196,35 +195,23 @@ void NpcHandler::selectAutoSpell(const int skillId) const outMsg.writeInt32(static_cast(skillId), "skill id"); } -BeingId NpcHandler::getNpc(Net::MessageIn &msg) +BeingId NpcHandler::getNpc(Net::MessageIn &msg, + const NpcAction action) { - // +++ must be removed SMSG_* - 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); Ea::NpcRecv::mDialog = nullptr; - // +++ must be removed SMSG_* - if (msg.getId() == SMSG_NPC_VIEWPOINT) - return npcId; - if (diag == NpcDialog::mNpcDialogs.end()) { - // +++ must be removed SMSG_* // 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; -- cgit v1.2.3-60-g2f50