diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-02-24 20:33:57 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-02-24 20:33:57 -0700 |
commit | 4643ac4b683fff89164f7a1cfa0cd1a15797fb28 (patch) | |
tree | e2801b8fa3e54b08b9b2bf5f7c71cf17294d7e2f /src/net | |
parent | 8155f5673970015d21fcd80f078c4df01e06d9c9 (diff) | |
download | mana-client-4643ac4b683fff89164f7a1cfa0cd1a15797fb28.tar.gz mana-client-4643ac4b683fff89164f7a1cfa0cd1a15797fb28.tar.bz2 mana-client-4643ac4b683fff89164f7a1cfa0cd1a15797fb28.tar.xz mana-client-4643ac4b683fff89164f7a1cfa0cd1a15797fb28.zip |
Fix handling of next and close packets
If we aren't talking with the NPC that they originate from, just send
off the next dialog packet, as empty dialogs don't help. This prevents
problems with ivisible NPCs that just send close (which was ignored by
older clients anyways).
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/npchandler.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp index a6dc216b..5ae2ac2e 100644 --- a/src/net/npchandler.cpp +++ b/src/net/npchandler.cpp @@ -54,6 +54,7 @@ NPCHandler::NPCHandler() void NPCHandler::handleMessage(MessageIn *msg) { int id; + NPC *temporaryNPC; switch (msg->getId()) { @@ -78,15 +79,24 @@ void NPCHandler::handleMessage(MessageIn *msg) case SMSG_NPC_CLOSE: id = msg->readInt32(); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); - npcTextDialog->showCloseButton(); + temporaryNPC = dynamic_cast<NPC*>(beingManager->findBeing(id)); + // If we're talking to that NPC, show the close button + if (temporaryNPC == current_npc) + npcTextDialog->showCloseButton(); + // Otherwise, move on as an empty dialog doesn't help + else + temporaryNPC->nextDialog(); break; case SMSG_NPC_NEXT: - // Next button in NPC dialog, currently unused id = msg->readInt32(); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); - npcTextDialog->showNextButton(); + temporaryNPC = dynamic_cast<NPC*>(beingManager->findBeing(id)); + // If we're talking to that NPC, show the next button + if (temporaryNPC == current_npc) + npcTextDialog->showNextButton(); + else + // Otherwise, move on as an empty dialog doesn't help + temporaryNPC->nextDialog(); break; case SMSG_NPC_INT_INPUT: |