summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-11-12 15:11:47 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-11-12 15:11:47 +0000
commit526f9a301caa29d1922561104de9aea8bc213b65 (patch)
treebc2852547d0b41843375dcf406c00e1ee54117d9 /src/gui
parent628ac878c21c5150528b969ac151cd2450e2549d (diff)
downloadmana-client-526f9a301caa29d1922561104de9aea8bc213b65.tar.gz
mana-client-526f9a301caa29d1922561104de9aea8bc213b65.tar.bz2
mana-client-526f9a301caa29d1922561104de9aea8bc213b65.tar.xz
mana-client-526f9a301caa29d1922561104de9aea8bc213b65.zip
NPC lists
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp1
-rw-r--r--src/gui/chat.cpp3
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/npc.cpp24
4 files changed, 23 insertions, 7 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index b4294f3d..b1b88393 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -121,6 +121,7 @@ void char_select() {
if((gui_exit==3)||((key[KEY_ENTER])&&(strcmp(button_state, "Del")==0)))server_char_select();
else if(gui_exit==4)close_session();
else if(gui_exit==5)server_char_delete();
+ //alert("","","","","",0,0);
if(state==LOGIN)close_session();
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 10823e3c..e8cfa4cc 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -184,7 +184,8 @@ char * Chat::chat_send(std::string nick, std::string msg) {
if(msg.substr(0,IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE) {
msg.erase(0,IS_ANNOUNCE_LENGTH);
packid = 0x0099;
- } else {
+ } else if(msg.substr(0,IS_WHERE_LENGTH) == IS_WHERE) {
+ } else {
packid = 0x008c;
}
// prepare ordinary message
diff --git a/src/gui/chat.h b/src/gui/chat.h
index c1126b52..fd6dae94 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -39,6 +39,8 @@
#define IS_ANNOUNCE "/announce "
#define IS_ANNOUNCE_LENGTH 10
+#define IS_WHERE "/where "
+#define IS_WHERE_LENGTH 7
/**
gets in between usernick and message text depending on
diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp
index 0b7a7102..37fc4eb2 100644
--- a/src/gui/npc.cpp
+++ b/src/gui/npc.cpp
@@ -50,7 +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 = NULL;
temp->name = name;
temp->next = NULL;
if(!item_head)
@@ -63,16 +63,29 @@ void add_item(char *name) {
item_number++;
}
+void remove_tail() {
+ int iterator = 0;
+ ITEM *temp = item_head;
+ while(iterator<item_number-2) {
+ temp = temp->next;
+ iterator++;
+ }
+ free(temp->next);
+ temp->next = NULL;
+ item_number--;
+}
+
void parse_items(char *string, short len) {
char *token = strtok(string, ":");
while(token!=NULL) {
- if(strcmp(token, "you prefer?")!=0) { // temp fix for the barber script
+ //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, ":");
- }
+ }
+ remove_tail();
}
void remove_all_items() {
@@ -87,6 +100,5 @@ void remove_all_items() {
}
item_head = NULL;
item_number = 0;
-}
-
+}