summaryrefslogtreecommitdiff
path: root/src/gui/npclistdialog.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-26 21:29:49 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-26 21:29:49 +0100
commit3008805eea4b972265597ba196ab05ce64c69965 (patch)
treed3195600e956e496b6b21f200fc04e5b08cab368 /src/gui/npclistdialog.cpp
parent3ad6ac47d4967870a54fddd66aa9996724115b94 (diff)
parent6b0cff837b7adae56dc90d12e9c0e256e6aab134 (diff)
downloadmana-3008805eea4b972265597ba196ab05ce64c69965.tar.gz
mana-3008805eea4b972265597ba196ab05ce64c69965.tar.bz2
mana-3008805eea4b972265597ba196ab05ce64c69965.tar.xz
mana-3008805eea4b972265597ba196ab05ce64c69965.zip
Merge branch 'aethyra/master'
Conflicts: data/graphics/images/login_wallpaper.png src/being.cpp src/beingmanager.cpp src/engine.cpp src/game.cpp src/gui/buysell.cpp src/gui/buysell.h src/gui/gui.h src/gui/npc_text.cpp src/gui/npc_text.h src/gui/npcintegerdialog.cpp src/gui/npclistdialog.cpp src/gui/npclistdialog.h src/gui/npcstringdialog.cpp src/gui/sell.cpp src/gui/shop.cpp src/gui/table.cpp src/net/beinghandler.cpp src/net/npchandler.cpp src/net/playerhandler.cpp src/npc.cpp src/npc.h src/shopitem.cpp src/shopitem.h src/utils/stringutils.cpp src/utils/stringutils.h src/utils/trim.h
Diffstat (limited to 'src/gui/npclistdialog.cpp')
-rw-r--r--src/gui/npclistdialog.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index fc7d2979..53d4f21f 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -51,7 +51,9 @@ NpcListDialog::NpcListDialog(Network *network):
mItemList = new ListBox(this);
mItemList->setWrappingEnabled(true);
+
gcn::ScrollArea *scrollArea = new ScrollArea(mItemList);
+
gcn::Button *okButton = new Button(_("OK"), "ok", this);
gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this);
@@ -90,6 +92,8 @@ void NpcListDialog::parseItems(const std::string &itemString)
void NpcListDialog::reset()
{
+ NPC::isTalking = false;
+ mItemList->setSelected(-1);
mItems.clear();
}
@@ -100,6 +104,7 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
{
// Send the selected index back to the server
int selectedIndex = mItemList->getSelected();
+
if (selectedIndex > -1)
{
choice = selectedIndex + 1;
@@ -118,10 +123,13 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
{
setVisible(false);
reset();
+
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(current_npc);
outMsg.writeInt8(choice);
+
+ current_npc = 0;
}
}
@@ -131,3 +139,9 @@ void NpcListDialog::setVisible(bool visible)
Window::setVisible(visible);
}
+
+void NpcListDialog::requestFocus()
+{
+ mItemList->requestFocus();
+ mItemList->setSelected(0);
+}