summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/npcdialog.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 1956ba85..12ea61a6 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -170,22 +170,20 @@ void NpcDialog::action(const gcn::ActionEvent &event)
else if (mActionState == NPC_ACTION_INPUT)
{
std::string printText = ""; // Text that will get printed in the textbox
+
if (mInputState == NPC_INPUT_LIST)
{
- int choice = 0;
- int selectedIndex = mItemList->getSelected();
-
- if (selectedIndex >= (int) mItems.size())
- {
- return;
- }
- else if (selectedIndex > -1)
- {
- choice = selectedIndex + 1;
- printText = mItems[selectedIndex];
- }
-
- Net::getNpcHandler()->listInput(mNpcId, choice);
+ int choice = 0;
+ int selectedIndex = mItemList->getSelected();
+
+ if (selectedIndex >= (int) mItems.size() || selectedIndex < 0)
+ {
+ return;
+ }
+ choice = selectedIndex + 1;
+ printText = mItems[selectedIndex];
+
+ Net::getNpcHandler()->listInput(mNpcId, choice);
}
else if (mInputState == NPC_INPUT_STRING)
{
@@ -343,6 +341,8 @@ void NpcDialog::buildLayout()
place(0, 0, mScrollArea, 5, 3);
place(0, 3, mListScrollArea, 5, 3);
place(3, 6, mButton, 2);
+
+ mItemList->setSelected(-1);
}
else if (mInputState == NPC_INPUT_STRING)
{