Browse Source

Fixed npc commands atcommand & charcommand not working with a custom command_symbol

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9431 54d463be-8e91-2dee-dedb-b68131a5f0ec
toms 18 years ago
parent
commit
912fc7a427
6 changed files with 21 additions and 18 deletions
  1. 5 2
      Changelog-Trunk.txt
  2. 3 3
      src/map/atcommand.c
  3. 1 1
      src/map/atcommand.h
  4. 3 3
      src/map/charcommand.c
  5. 1 1
      src/map/charcommand.h
  6. 8 8
      src/map/script.c

+ 5 - 2
Changelog-Trunk.txt

@@ -3,7 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
-2004/12/06
+2006/12/07
+	* Fixed npc commands atcommand & charcommand not working with a custom
+	  command_symbol [Toms]
+2006/12/06
 	* Changed the order of view-change packets for SC xmas/wedding, should fix
 	  crashing if you change into xmas suit while in fighting stance. [Skotlex]
 	* Renamed the mob mode Cast-Sensor Melee to Cast-Sensor idle since these
@@ -31,7 +34,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 	* Added StringBuf_Vprintf to utils.c and changed the showmsg.c buffer.
 	  Now it uses a static buffer and a StringBuf when needed (a debug message 
 	  indicating the static buffer needs to be increased is shown). [FlavioJS]
-2004/12/05
+2006/12/05
 	* The can log value now is "reset" when you die allowing you to
 	  respawn/quit instantly after death. [Skotlex]
 	* Fixed sc data load failing when using charsave_method: 1 [Skotlex]

+ 3 - 3
src/map/atcommand.c

@@ -42,7 +42,7 @@
 #include "mail.h"
 #endif
 
-static char command_symbol = '@'; // first char of the commands (by [Yor])
+char atcommand_symbol = '@'; // first char of the commands (by [Yor])
 
 char *msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
 
@@ -875,7 +875,7 @@ AtCommandType atcommand(struct map_session_data* sd, const int level, const char
 	if(p[0] == '|')
 		p += 3;
 
-	if (*p == command_symbol) { // check first char, try to skip |00 (or something else) [Lance]
+	if (*p == atcommand_symbol) { // check first char, try to skip |00 (or something else) [Lance]
 		char command[101];
 		int i = 0;
 		malloc_set(info, 0, sizeof(AtCommandInfo));
@@ -1008,7 +1008,7 @@ int atcommand_config_read(const char *cfgName) {
 				w2[0] != '%' && // symbol of party chat speaking
 				w2[0] != '$' && // symbol of guild chat
 				w2[0] != '#')	// symbol of charcommand
-			command_symbol = w2[0];
+			atcommand_symbol = w2[0];
 	}
 	fclose(fp);
 

+ 1 - 1
src/map/atcommand.h

@@ -327,7 +327,7 @@ void do_final_msg(void);
 char *estr_lower(char *str);
 
 int e_mail_check(char *email);
-
+extern char atcommand_symbol;
 #define MAX_MSG 1000
 extern char *msg_table[MAX_MSG];
 

+ 3 - 3
src/map/charcommand.c

@@ -28,7 +28,7 @@
 #include "charcommand.h"
 #include "atcommand.h"
 
-static char command_symbol = '#';
+char charcommand_symbol = '#';
 
 extern char *msg_table[1000]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
 
@@ -216,7 +216,7 @@ CharCommandType charcommand(struct map_session_data* sd, const int level, const
 	if(p[0] == '|')
 		p += 3;
 
-	if (*p == command_symbol) { // check first char, try to skip |00 (or something else) [Lance]
+	if (*p == charcommand_symbol) { // check first char, try to skip |00 (or something else) [Lance]
 		char command[101];
 		int i = 0;
 		malloc_set(info, 0, sizeof(CharCommandInfo));
@@ -299,7 +299,7 @@ int charcommand_config_read(const char *cfgName) {
 				w2[0] != '%' && // symbol of party chat speaking
 				w2[0] != '$' && // symbol of guild chat speaking
 				w2[0] != '@')	// symbol of atcommand
-			command_symbol = w2[0];
+			charcommand_symbol = w2[0];
 	}
 	fclose(fp);
 

+ 1 - 1
src/map/charcommand.h

@@ -69,6 +69,6 @@ CharCommandType charcommand(
 int get_charcommand_level(const CharCommandType type);
 
 int charcommand_config_read(const char *cfgName);
-
+extern char charcommand_symbol;	
 #endif
 

+ 8 - 8
src/map/script.c

@@ -10131,9 +10131,9 @@ int buildin_atcommand(struct script_state *st)
 		sd = script_rid2sd(st);
 
 	if (sd){
-		if(cmd[0] != '@'){
+		if(cmd[0] != atcommand_symbol){
 			cmd += strlen(sd->status.name);
-			while(*cmd != '@' && *cmd != 0)
+			while(*cmd != atcommand_symbol && *cmd != 0)
 				cmd++;
 		}
 		atcommand_sub(sd->fd, sd, cmd, 99);
@@ -10147,9 +10147,9 @@ int buildin_atcommand(struct script_state *st)
 			if (bl->type == BL_NPC)
 				strncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
 		}
-		if(cmd[0] != '@'){
+		if(cmd[0] != atcommand_symbol){
 			cmd += strlen(dummy_sd.status.name);
-			while(*cmd != '@' && *cmd != 0)
+			while(*cmd != atcommand_symbol && *cmd != 0)
 				cmd++;
 		}
 		atcommand_sub(0, &dummy_sd, cmd, 99);
@@ -10169,9 +10169,9 @@ int buildin_charcommand(struct script_state *st)
 		sd = script_rid2sd(st);
 	
 	if (sd){ 
-		if(cmd[0] != '#'){
+		if(cmd[0] != charcommand_symbol){
 			cmd += strlen(sd->status.name);
-			while(*cmd != '#' && *cmd != 0)
+			while(*cmd != charcommand_symbol && *cmd != 0)
 				cmd++;
 		}
 		charcommand_sub(sd->fd, sd, cmd,99);
@@ -10185,9 +10185,9 @@ int buildin_charcommand(struct script_state *st)
 			if (bl->type == BL_NPC)
 				strncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
 		}
-		if(cmd[0] != '#'){
+		if(cmd[0] != charcommand_symbol){
 			cmd += strlen(dummy_sd.status.name);
-			while(*cmd != '#' && *cmd != 0)
+			while(*cmd != charcommand_symbol && *cmd != 0)
 				cmd++;
 		}
 		charcommand_sub(0, &dummy_sd, cmd, 99);