diff options
Diffstat (limited to 'src/net/npchandler.cpp')
-rw-r--r-- | src/net/npchandler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp index a803710e..da21b2a5 100644 --- a/src/net/npchandler.cpp +++ b/src/net/npchandler.cpp @@ -49,18 +49,22 @@ NPCHandler::NPCHandler() void NPCHandler::handleMessage(MessageIn *msg) { + int id; + switch (msg->getId()) { case SMSG_NPC_CHOICE: msg->readInt16(); // length - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(msg->readInt32())); + id = msg->readInt32(); + current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); npcListDialog->parseItems(msg->readString(msg->getLength() - 8)); npcListDialog->setVisible(true); break; case SMSG_NPC_MESSAGE: msg->readInt16(); // length - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(msg->readInt32())); + id = msg->readInt32(); + current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); npcTextDialog->addText(msg->readString(msg->getLength() - 8)); npcListDialog->setVisible(false); npcTextDialog->setVisible(true); |