summaryrefslogtreecommitdiff
path: root/src/gui/npc_text.cpp
diff options
context:
space:
mode:
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;