summaryrefslogtreecommitdiff
path: root/src/gui/npclistdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/npclistdialog.cpp')
-rw-r--r--src/gui/npclistdialog.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 73b00239..53d4f21f 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.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
@@ -24,6 +23,7 @@
#include "button.h"
#include "listbox.h"
+#include "npc_text.h"
#include "npclistdialog.h"
#include "scrollarea.h"
@@ -35,6 +35,9 @@
#include "../net/protocol.h"
#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
+
+extern NpcTextDialog *npcTextDialog;
NpcListDialog::NpcListDialog(Network *network):
Window(_("NPC")), mNetwork(network)
@@ -49,10 +52,10 @@ NpcListDialog::NpcListDialog(Network *network):
mItemList = new ListBox(this);
mItemList->setWrappingEnabled(true);
- scrollArea = new ScrollArea(mItemList);
+ gcn::ScrollArea *scrollArea = new ScrollArea(mItemList);
- 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);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
@@ -89,7 +92,7 @@ void NpcListDialog::parseItems(const std::string &itemString)
void NpcListDialog::reset()
{
- NPC::mTalking = false;
+ NPC::isTalking = false;
mItemList->setSelected(-1);
mItems.clear();
}
@@ -97,18 +100,23 @@ 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
int selectedIndex = mItemList->getSelected();
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"));
+ npcTextDialog->showCloseButton();
}
if (choice)
@@ -125,6 +133,13 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
}
}
+void NpcListDialog::setVisible(bool visible)
+{
+ if (visible) npcTextDialog->setVisible(true);
+
+ Window::setVisible(visible);
+}
+
void NpcListDialog::requestFocus()
{
mItemList->requestFocus();