From 92ca697f6d18b2c760b62be705e1c037d5be4588 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 10 Jan 2012 21:07:01 +0000 Subject: Xantara's fix for bugreport:5201, bugreport:5222 and bugreport:5227 (@command related stuff) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15418 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 3dadc888d..3ac0fe572 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9305,6 +9305,7 @@ int atcommand_config_read(const char* cfgName) char line[1024], w1[1024], w2[1024], w3[1024], w4[1024]; AtCommandInfo* p; FILE* fp; + int i; if( (fp = fopen(cfgName, "r")) == NULL ) { ShowError("AtCommand configuration file not found: %s\n", cfgName); @@ -9314,8 +9315,7 @@ int atcommand_config_read(const char* cfgName) while( fgets(line, sizeof(line), fp) ) { if( line[0] == '/' && line[1] == '/' ) continue; - - if( ( sscanf(line,"%1023[^:]:%1023[^,],%1023[^[][%1023[^]]",w1,w2,w3,w4) ) == 4 ) { + if( ( i = sscanf(line,"%1023[^:]:%1023[^,],%1023[^[][%1023[^]]",w1,w2,w3,w4) ) >= 3 ) { if( ( p = (AtCommandInfo*)strdb_get(atcommand_db, w1) ) != NULL ) { p->level = atoi(w2);//update @level @@ -9324,13 +9324,17 @@ int atcommand_config_read(const char* cfgName) /** * Parse the alises **/ - atcommand_parse_aliases(w4,p); + if( i == 4 ) + atcommand_parse_aliases(w4,p); continue;//we're done move on } - } else if( strcmpi(w1, "import") != 0 && strcmpi(w1, "command_symbol") != 0 && strcmpi(w1, "char_symbol") != 0 ) + } else if( strcmpi(w1, "import") != 0 && strcmpi(w1, "command_symbol") != 0 && strcmpi(w1, "char_symbol") != 0 ) { + if( i > 1 ) + ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName); continue; - + } + normalize_name(w2," ");//trim if( strcmpi(w1, "import") == 0 ) atcommand_config_read(w2); else if( strcmpi(w1, "command_symbol") == 0 && @@ -9347,8 +9351,6 @@ int atcommand_config_read(const char* cfgName) w2[0] != '$' && w2[0] != '@' ) charcommand_symbol = w2[0]; - else - ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName); } fclose(fp); -- cgit v1.2.3-70-g09d2