From 9dfc4ea2f30f43fb5ffd239b90b2a7259fbe0330 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 16 Feb 2009 14:41:24 +0000 Subject: Add next/close buttons for NPCs And keep the text dialog open for the whole transaction, logging user input and keep a full record of text from the NPC (for the current transaction only). --- src/gui/npclistdialog.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gui/npclistdialog.cpp') diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index fe924da1..78d43fd2 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -23,6 +23,7 @@ #include "button.h" #include "listbox.h" +#include "npc_text.h" #include "npclistdialog.h" #include "scrollarea.h" @@ -31,6 +32,9 @@ #include "../npc.h" #include "../utils/gettext.h" +#include "../utils/strprintf.h" + +extern NpcTextDialog *npcTextDialog; NpcListDialog::NpcListDialog(): Window(_("NPC")) @@ -89,7 +93,6 @@ void NpcListDialog::reset() void NpcListDialog::action(const gcn::ActionEvent &event) { int choice = 0; - if (event.getId() == "ok") { // Send the selected index back to the server @@ -97,11 +100,14 @@ void NpcListDialog::action(const gcn::ActionEvent &event) if (selectedIndex > -1) { choice = selectedIndex + 1; + npcTextDialog->addText(strprintf("\n> \"%s\"\n", + mItems[selectedIndex].c_str())); } } else if (event.getId() == "cancel") { choice = 0xff; // 0xff means cancel + npcTextDialog->addText(_("\n> Cancel\n")); } if (choice) @@ -109,6 +115,5 @@ void NpcListDialog::action(const gcn::ActionEvent &event) setVisible(false); reset(); current_npc->dialogChoice(choice); - current_npc = 0; } } -- cgit v1.2.3-70-g09d2