summaryrefslogtreecommitdiff
path: root/src/gui/npc.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-27 20:13:45 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-27 20:13:45 +0000
commitfc342cc8deacdf826e343b1ce796b47bbd918f61 (patch)
tree56c6b33198313f112dc5b56a5bf14bb7e0a9fad5 /src/gui/npc.cpp
parent10f77f010f8831368ab359074f6e0640961f3818 (diff)
downloadmana-fc342cc8deacdf826e343b1ce796b47bbd918f61.tar.gz
mana-fc342cc8deacdf826e343b1ce796b47bbd918f61.tar.bz2
mana-fc342cc8deacdf826e343b1ce796b47bbd918f61.tar.xz
mana-fc342cc8deacdf826e343b1ce796b47bbd918f61.zip
Fix the bug where sometimes the last entry in the npc list windows is missing.
Diffstat (limited to 'src/gui/npc.cpp')
-rw-r--r--src/gui/npc.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp
index 084f2f6a..99d3b3a5 100644
--- a/src/gui/npc.cpp
+++ b/src/gui/npc.cpp
@@ -80,23 +80,21 @@ std::string NpcListDialog::getElementAt(int i)
return items[i];
}
-void NpcListDialog::parseItems(const char *string) {
- char *copy = new char[strlen(string) + 1];
- strcpy(copy, string);
+void NpcListDialog::parseItems(const char *string, unsigned short len) {
+ char *copy = new char[len + 1];
+ strncpy(copy, string, len);
+ copy[len] = 0;
char *token = strtok(copy, ":");
- while (token != NULL) {
+ while (token) {
char *temp = (char*)malloc(strlen(token) + 1);
strcpy(temp, token);
items.push_back(std::string(temp));
token = strtok(NULL, ":");
}
-
- // TEMP: remove the last item insrted (fixes an athena bug probably)
- items.pop_back();
-
+
delete[] copy;
-}
+}
void NpcListDialog::reset() {
items.clear();