summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-10 21:07:01 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-10 21:07:01 +0000
commit92ca697f6d18b2c760b62be705e1c037d5be4588 (patch)
tree63fd7f59769bec4d938456e8f65571570a823f40 /src/map/atcommand.c
parentfbd018466a35e9d57c1be2b8e8dc6e2904965415 (diff)
downloadhercules-92ca697f6d18b2c760b62be705e1c037d5be4588.tar.gz
hercules-92ca697f6d18b2c760b62be705e1c037d5be4588.tar.bz2
hercules-92ca697f6d18b2c760b62be705e1c037d5be4588.tar.xz
hercules-92ca697f6d18b2c760b62be705e1c037d5be4588.zip
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
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c16
1 files changed, 9 insertions, 7 deletions
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);