diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-10 17:45:15 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-10 17:45:15 +0000 |
commit | 81219329d4090dd2b1e3c37ae005f3c7795f4d08 (patch) | |
tree | d8e96d296112189cd5bbf46db4a6c483eb027cf6 | |
parent | 5f685256ba8786b133b14f8702c7e71e0d9d4bcd (diff) | |
download | mana-client-81219329d4090dd2b1e3c37ae005f3c7795f4d08.tar.gz mana-client-81219329d4090dd2b1e3c37ae005f3c7795f4d08.tar.bz2 mana-client-81219329d4090dd2b1e3c37ae005f3c7795f4d08.tar.xz mana-client-81219329d4090dd2b1e3c37ae005f3c7795f4d08.zip |
Removed colon in NPC choice messages.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/gui/npclistdialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/npclistdialog.h | 7 | ||||
-rw-r--r-- | src/net/npchandler.cpp | 9 |
4 files changed, 15 insertions, 16 deletions
@@ -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; |