summaryrefslogtreecommitdiff
path: root/src/gui/npc_text.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-18 06:57:16 +0000
committerJared Adams <jaxad0127@gmail.com>2009-02-18 06:57:16 +0000
commit9568a305878d0c035e027c1ed6c9a24147a0adea (patch)
treeca6f2d1d61114f11057938c654ec004042412f1f /src/gui/npc_text.cpp
parenta0edd2e04b263faa13f6fbfbb81dd7c64520e584 (diff)
downloadmana-client-9568a305878d0c035e027c1ed6c9a24147a0adea.tar.gz
mana-client-9568a305878d0c035e027c1ed6c9a24147a0adea.tar.bz2
mana-client-9568a305878d0c035e027c1ed6c9a24147a0adea.tar.xz
mana-client-9568a305878d0c035e027c1ed6c9a24147a0adea.zip
Centralize current_npc cleanup
Diffstat (limited to 'src/gui/npc_text.cpp')
-rw-r--r--src/gui/npc_text.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 0a8a4e4d..e6f039a0 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -91,19 +91,15 @@ void NpcTextDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok")
{
- switch (mState) {
- case NPC_TEXT_STATE_NEXT:
- current_npc->nextDialog();
- addText("\n> Next\n");
- break;
- case NPC_TEXT_STATE_CLOSE:
- setText("");
- setVisible(false);
- current_npc = NULL;
- break;
- default:
- return;
- }
+ if (mState == NPC_TEXT_STATE_NEXT && current_npc) {
+ current_npc->nextDialog();
+ addText("\n> Next\n");
+ } else if (mState == NPC_TEXT_STATE_CLOSE ||
+ mState == NPC_TEXT_STATE_NEXT && !current_npc) {
+ setText("");
+ setVisible(false);
+ if (current_npc) current_npc->handleDeath();
+ } else return;
}
else return;