summaryrefslogtreecommitdiff
path: root/src/gui/npcstringdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/npcstringdialog.cpp')
-rw-r--r--src/gui/npcstringdialog.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index ef2de73a..d9bf5682 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +20,7 @@
*/
#include "button.h"
+#include "npc_text.h"
#include "npcstringdialog.h"
#include "textfield.h"
@@ -29,14 +29,17 @@
#include "../npc.h"
#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
+
+extern NpcTextDialog *npcTextDialog;
NpcStringDialog::NpcStringDialog():
Window(_("NPC Text Request"))
{
mValueField = new TextField("");
- okButton = new Button(_("OK"), "ok", this);
- cancelButton = new Button(_("Cancel"), "cancel", this);
+ gcn::Button *okButton = new Button(_("OK"), "ok", this);
+ gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this);
place(0, 0, mValueField, 3);
place(1, 1, cancelButton);
@@ -54,18 +57,24 @@ std::string NpcStringDialog::getValue()
void NpcStringDialog::setValue(const std::string &value)
{
mValueField->setText(value);
+ mDefault = value;
}
void NpcStringDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "cancel")
{
- mValueField->setText("");
+ mValueField->setText(mDefault);
+ npcTextDialog->addText(_("\n> Cancel\n"));
+ }
+ else
+ {
+ npcTextDialog->addText(strprintf("\n> \"%s\"\n",
+ mValueField->getText().c_str()));
}
setVisible(false);
current_npc->stringInput(mValueField->getText());
- current_npc = NULL;
mValueField->setText("");
}