diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-25 19:04:39 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-25 19:04:39 -0700 |
commit | 0dde31c3db09113639fa443142995b6efcff6646 (patch) | |
tree | 9e91488f812067dae7a91f84393a930ffe31b626 /src/gui/npcstringdialog.cpp | |
parent | 6cd131052c78af04e794409189a0d7e16dcc0c51 (diff) | |
download | mana-0dde31c3db09113639fa443142995b6efcff6646.tar.gz mana-0dde31c3db09113639fa443142995b6efcff6646.tar.bz2 mana-0dde31c3db09113639fa443142995b6efcff6646.tar.xz mana-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/npcstringdialog.cpp')
-rw-r--r-- | src/gui/npcstringdialog.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index 140ca40f..f2c7434c 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -28,10 +28,13 @@ #include "../npc.h" +#include "../net/messageout.h" +#include "../net/protocol.h" + #include "../utils/gettext.h" -NpcStringDialog::NpcStringDialog(): - Window(_("NPC Text Request")) +NpcStringDialog::NpcStringDialog(Network *network): + Window(_("NPC Text Request")), mNetwork(network) { mValueField = new TextField(""); @@ -64,12 +67,19 @@ void NpcStringDialog::action(const gcn::ActionEvent &event) } setVisible(false); + NPC::mTalking = false; - if (current_npc) - current_npc->stringInput(mValueField->getText()); - - current_npc = NULL; + std::string text = mValueField->getText(); mValueField->setText(""); + + MessageOut outMsg(mNetwork); + outMsg.writeInt16(CMSG_NPC_STR_RESPONSE); + outMsg.writeInt16(text.length() + 9); + outMsg.writeInt32(current_npc); + outMsg.writeString(text, text.length()); + outMsg.writeInt8(0); + + current_npc = 0; } bool NpcStringDialog::isInputFocused() |