summaryrefslogtreecommitdiff
path: root/src/gui/npc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/npc.cpp')
-rw-r--r--src/gui/npc.cpp14
1 files changed, 9 insertions, 5 deletions
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;
}