From f77a6feaee829ac7273faa119c07c6f3566deaef Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 31 Jul 2012 00:58:18 +0300 Subject: Add support for clear npc dialog by command from server (evol only). --- src/gui/npcdialog.cpp | 9 ++++++--- src/gui/npcdialog.h | 2 ++ src/net/tmwa/npchandler.cpp | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 116935afd..567fcda06 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -334,9 +334,7 @@ void NpcDialog::action(const gcn::ActionEvent &event) } else if (event.getId() == "clear") { - mTextBox->clearRows(); -// mTextBox->addRow(mNewText); -// setText(mNewText); + clearRows(); } else if (event.getId() == "close") { @@ -760,3 +758,8 @@ void NpcDialog::logic() } } } + +void NpcDialog::clearRows() +{ + mTextBox->clearRows(); +} diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index e3cc274c8..cd5f7fe57 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -200,6 +200,8 @@ class NpcDialog : public Window, public gcn::ActionListener, void logic(); + void clearRows(); + private: typedef std::list DialogList; static DialogList instances; diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index c086cc7e4..6cd02c6e2 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -309,6 +309,11 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg, int npcId) if (mDialog) mDialog->setAvatarAction(msg.readInt32()); // direction break; + case 9: // clear npc dialog + if (mDialog) + mDialog->clearRows(); + break; + default: logger->log("unknown npc command: %d", cmd); break; -- cgit v1.2.3-70-g09d2