diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-02-16 14:41:24 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-16 15:42:48 -0700 |
commit | d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c (patch) | |
tree | d02c3e0451df5d997e841a865943d411f1dc786e | |
parent | 4924e4a50ae31c30f783285f6e10ac3651c1e6e8 (diff) | |
download | mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.tar.gz mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.tar.bz2 mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.tar.xz mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.zip |
Fixed up NPC dialogs to behave more like eAthena expects.
-rw-r--r-- | src/gui/npc_text.cpp | 19 | ||||
-rw-r--r-- | src/gui/npc_text.h | 3 | ||||
-rw-r--r-- | src/gui/npcintegerdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/npclistdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/npcstringdialog.cpp | 6 | ||||
-rw-r--r-- | src/net/npchandler.cpp | 3 | ||||
-rw-r--r-- | src/npc.cpp | 4 |
7 files changed, 21 insertions, 18 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index 88db46b3..ed75b76e 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -45,14 +45,15 @@ NpcTextDialog::NpcTextDialog(): mTextBox->setEditable(false); mTextBox->setOpaque(false); - scrollArea = new ScrollArea(mTextBox); - okButton = new Button(_("OK"), "ok", this); + mScrollArea = new ScrollArea(mTextBox); + mButton = new Button(_("OK"), "", this); + mButton->setActionEventId("ok"); - scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - scrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); + mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); - place(0, 0, scrollArea, 5).setPadding(3); - place(4, 1, okButton); + place(0, 0, mScrollArea, 5).setPadding(3); + place(4, 1, mButton); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); @@ -64,7 +65,7 @@ NpcTextDialog::NpcTextDialog(): void NpcTextDialog::setText(const std::string &text) { mText = text; - mTextBox->setTextWrapped(mText, scrollArea->getWidth() - 15); + mTextBox->setTextWrapped(mText, mScrollArea->getWidth() - 15); } void NpcTextDialog::addText(const std::string &text) @@ -78,9 +79,11 @@ void NpcTextDialog::action(const gcn::ActionEvent &event) { setText(""); setVisible(false); + if (current_npc) current_npc->nextDialog(); - current_npc = 0; + + current_npc = NULL; } } diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 1f2abd42..5e2ff118 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -80,8 +80,9 @@ class NpcTextDialog : public Window, public gcn::ActionListener private: gcn::Button *okButton; - gcn::ScrollArea *scrollArea; + gcn::ScrollArea *mScrollArea; TextBox *mTextBox; + gcn::Button *mButton; std::string mText; }; diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 9db71d67..ea3398c9 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -100,7 +100,7 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event) { setVisible(false); current_npc->integerInput(mValueField->getValue()); - current_npc = 0; + current_npc = NULL; mValueField->reset(); } } diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 59bf0716..81c33049 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -110,6 +110,6 @@ void NpcListDialog::action(const gcn::ActionEvent &event) setVisible(false); reset(); current_npc->dialogChoice(choice); - current_npc = 0; + current_npc = NULL; } } diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index 8d66d9bc..ef2de73a 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -24,12 +24,12 @@ #include "npcstringdialog.h" #include "textfield.h" +#include "widgets/layout.h" + #include "../npc.h" #include "../utils/gettext.h" -#include "widgets/layout.h" - NpcStringDialog::NpcStringDialog(): Window(_("NPC Text Request")) { @@ -65,7 +65,7 @@ void NpcStringDialog::action(const gcn::ActionEvent &event) setVisible(false); current_npc->stringInput(mValueField->getText()); - current_npc = 0; + current_npc = NULL; mValueField->setText(""); } diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp index 8425a215..8ca529c8 100644 --- a/src/net/npchandler.cpp +++ b/src/net/npchandler.cpp @@ -79,8 +79,7 @@ void NPCHandler::handleMessage(MessageIn *msg) case SMSG_NPC_CLOSE: id = msg->readInt32(); - if (current_npc == dynamic_cast<NPC*>(beingManager->findBeing(id))) - current_npc = NULL; + current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); break; case SMSG_NPC_NEXT: diff --git a/src/npc.cpp b/src/npc.cpp index c667e11e..3edb57a0 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -145,9 +145,9 @@ void NPC::stringInput(const std::string &value) { MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_STR_RESPONSE); - outMsg.writeInt16(value.length() + 15); + outMsg.writeInt16(value.length() + 9); outMsg.writeInt32(mId); - outMsg.writeString(value, value.length() + 6); + outMsg.writeString(value, value.length()); outMsg.writeInt8(0); } |