diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-30 22:32:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-30 22:32:39 +0300 |
commit | 3f8010f23e112c1cf6506c327cdddc5260867299 (patch) | |
tree | 8f594a37ca9a89f0837ee4f4a98b5b7bb9a950c0 /src/net/eathena/npchandler.cpp | |
parent | 105745205558ea0f4f8705e1630a6f7055c68e34 (diff) | |
download | manaplus-3f8010f23e112c1cf6506c327cdddc5260867299.tar.gz manaplus-3f8010f23e112c1cf6506c327cdddc5260867299.tar.bz2 manaplus-3f8010f23e112c1cf6506c327cdddc5260867299.tar.xz manaplus-3f8010f23e112c1cf6506c327cdddc5260867299.zip |
Simplify getNpc function usage.
Diffstat (limited to 'src/net/eathena/npchandler.cpp')
-rw-r--r-- | src/net/eathena/npchandler.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 76ae7d3b5..a15d6480e 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -65,32 +65,32 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_NPC_CHOICE: - getNpc(msg, true); + getNpc(msg); processNpcChoice(msg); break; case SMSG_NPC_MESSAGE: - getNpc(msg, true); + getNpc(msg); processNpcMessage(msg); break; case SMSG_NPC_CLOSE: - getNpc(msg, false); + getNpc(msg); processNpcClose(msg); break; case SMSG_NPC_NEXT: - getNpc(msg, false); + getNpc(msg); processNpcNext(msg); break; case SMSG_NPC_INT_INPUT: - getNpc(msg, false); + getNpc(msg); processNpcIntInput(msg); break; case SMSG_NPC_STR_INPUT: - getNpc(msg, false); + getNpc(msg); processNpcStrInput(msg); break; @@ -99,7 +99,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_NPC_VIEWPOINT: - getNpc(msg, true); + npcId = getNpc(msg); processNpcViewPoint(msg, npcId); break; @@ -196,10 +196,14 @@ void NpcHandler::sellItem(const int beingId A_UNUSED, outMsg.writeInt16(static_cast<int16_t>(amount)); } -int NpcHandler::getNpc(Net::MessageIn &msg, const bool haveLength) +int NpcHandler::getNpc(Net::MessageIn &msg) { - if (haveLength) + if (msg.getId() == SMSG_NPC_CHOICE + || msg.getId() == SMSG_NPC_MESSAGE + || msg.getId() == SMSG_NPC_VIEWPOINT) + { msg.readInt16(); // length + } const int npcId = msg.readInt32(); |