summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/gui/npclistdialog.cpp10
-rw-r--r--src/gui/npclistdialog.h7
-rw-r--r--src/net/npchandler.cpp9
4 files changed, 15 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index dcdf44dd..c966db60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-10 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+
+ * src/gui/npclistdialog.cpp, src/gui/npclistdialog.h,
+ src/net/npchandler.cpp: Removed colon in NPC choice messages.
+
2007-08-09 Guillaume Melquiond <guillaume.melquiond@gmail.com>
* po/POTFILES.in: Updated list of translatable source files.
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 487bdf60..ff017a0e 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -75,15 +75,9 @@ NpcListDialog::getElementAt(int i)
return mItems[i];
}
-void
-NpcListDialog::parseItems(const std::string &itemString)
+void NpcListDialog::addItem(std::string const &item)
{
- std::istringstream iss(itemString);
-
- std::string tmp;
- while(getline(iss, tmp, ':')) {
- mItems.push_back(tmp);
- }
+ mItems.push_back(item);
}
void
diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h
index c09b0a8c..02b9cd49 100644
--- a/src/gui/npclistdialog.h
+++ b/src/gui/npclistdialog.h
@@ -69,12 +69,9 @@ class NpcListDialog : public Window, public gcn::ActionListener,
getElementAt(int i);
/**
- * Fills the options list for an NPC dialog.
- *
- * @param itemString A string with the options separated with colons.
+ * Adds an item to the option list.
*/
- void
- parseItems(const std::string &itemString);
+ void addItem(std::string const &);
/**
* Resets the list by removing all items.
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 888a3a29..9cc93df1 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -54,17 +54,20 @@ void NPCHandler::handleMessage(MessageIn &msg)
}
current_npc = static_cast< NPC * >(being);
- std::string text = msg.readString(msg.getUnreadLength());
switch (msg.getId())
{
case GPMSG_NPC_CHOICE:
- npcListDialog->parseItems(text);
+ npcListDialog->reset();
+ while (msg.getUnreadLength())
+ {
+ npcListDialog->addItem(msg.readString());
+ }
npcListDialog->setVisible(true);
break;
case GPMSG_NPC_MESSAGE:
- npcTextDialog->addText(text);
+ npcTextDialog->addText(msg.readString(msg.getUnreadLength()));
npcListDialog->setVisible(false);
npcTextDialog->setVisible(true);
break;