summaryrefslogtreecommitdiff
path: root/src/gui/npclistdialog.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-25 19:04:39 -0700
committerIra Rice <irarice@gmail.com>2009-02-25 19:04:39 -0700
commit0dde31c3db09113639fa443142995b6efcff6646 (patch)
tree9e91488f812067dae7a91f84393a930ffe31b626 /src/gui/npclistdialog.cpp
parent6cd131052c78af04e794409189a0d7e16dcc0c51 (diff)
downloadmana-client-0dde31c3db09113639fa443142995b6efcff6646.tar.gz
mana-client-0dde31c3db09113639fa443142995b6efcff6646.tar.bz2
mana-client-0dde31c3db09113639fa443142995b6efcff6646.tar.xz
mana-client-0dde31c3db09113639fa443142995b6efcff6646.zip
Fix NPC handling to not need a handle on the NPC
Loosely based on TMW commit f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1 Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/npclistdialog.cpp')
-rw-r--r--src/gui/npclistdialog.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 2c4dfc04..73b00239 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -31,10 +31,13 @@
#include "../npc.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../utils/gettext.h"
-NpcListDialog::NpcListDialog():
- Window(_("NPC"))
+NpcListDialog::NpcListDialog(Network *network):
+ Window(_("NPC")), mNetwork(network)
{
setResizable(true);
@@ -86,6 +89,7 @@ void NpcListDialog::parseItems(const std::string &itemString)
void NpcListDialog::reset()
{
+ NPC::mTalking = false;
mItemList->setSelected(-1);
mItems.clear();
}
@@ -112,10 +116,12 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
setVisible(false);
reset();
- if (current_npc)
- current_npc->dialogChoice(choice);
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeInt8(choice);
- current_npc = NULL;
+ current_npc = 0;
}
}