summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-11-07 18:54:50 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-11-07 18:54:50 +0000
commitf99992a5dee7e43d40826dce00cdab69909a9479 (patch)
treee160777a0f5b2492904eea2360d0c38c6a4d6466 /src
parent164304107f38397434a0b251c3a2f0ee106ecdbe (diff)
downloadmana-f99992a5dee7e43d40826dce00cdab69909a9479.tar.gz
mana-f99992a5dee7e43d40826dce00cdab69909a9479.tar.bz2
mana-f99992a5dee7e43d40826dce00cdab69909a9479.tar.xz
mana-f99992a5dee7e43d40826dce00cdab69909a9479.zip
NPC lists
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/npc.cpp14
2 files changed, 10 insertions, 6 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 0dec4268..0a0534f5 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -813,7 +813,7 @@ void do_parse() {
// List in NPC dialog
case 0x00b7:
current_npc = RFIFOL(4);
- alert(RFIFOP(8),"","","","",0,0);
+ //alert(RFIFOP(8),"","","","",0,0);
parse_items(RFIFOP(8), RFIFOW(2));
show_npc_dialog = 5;
break;
diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp
index 43deb1a8..0b7a7102 100644
--- a/src/gui/npc.cpp
+++ b/src/gui/npc.cpp
@@ -50,6 +50,7 @@ char *item_list(int index, int *list_size) {
void add_item(char *name) {
ITEM *item = item_head;
ITEM *temp = (ITEM *)malloc(sizeof(ITEM));
+ temp->name = NULL;
temp->name = name;
temp->next = NULL;
if(!item_head)
@@ -65,11 +66,13 @@ void add_item(char *name) {
void parse_items(char *string, short len) {
char *token = strtok(string, ":");
while(token!=NULL) {
- char *temp = (char *)malloc(strlen(token));
- strcpy(temp, token);
- add_item(temp);
+ if(strcmp(token, "you prefer?")!=0) { // temp fix for the barber script
+ char *temp = (char *)malloc(strlen(token));
+ strcpy(temp, token);
+ add_item(temp);
+ }
token = strtok(NULL, ":");
- }
+ }
}
void remove_all_items() {
@@ -77,7 +80,8 @@ void remove_all_items() {
temp = item_head;
while(temp) {
next = temp->next;
- free(temp->name);
+ /*if(temp->name!=NULL)
+ free(temp->name);*/ //buggy
free(temp);
temp = next;
}