diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/map/script.c b/src/map/script.c index 46a73fbd7..a8bedd633 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1479,8 +1479,8 @@ static void add_buildin_func(void) static void read_constdb(void) { FILE *fp; - char line[1024],name[1024]; - int val,n,i,type; + char line[1024],name[1024],val[1024]; + int n,i,type; sprintf(line, "%s/const.txt", db_path); fp=fopen(line, "r"); @@ -1492,8 +1492,9 @@ static void read_constdb(void) if(line[0]=='/' && line[1]=='/') continue; type=0; - if(sscanf(line,"%[A-Za-z0-9_],%d,%d",name,&val,&type)>=2 || - sscanf(line,"%[A-Za-z0-9_] %d %d",name,&val,&type)>=2){ + if(sscanf(line,"%[A-Za-z0-9_],%[0-9xXA-Fa-f],%d",name,val,&type)>=2 || + sscanf(line,"%[A-Za-z0-9_] %[0-9xXA-Fa-f] %d",name,val,&type)>=2){ + for(i=0;name[i];i++) name[i]=tolower(name[i]); n=add_str((const unsigned char *) name); @@ -1501,7 +1502,7 @@ static void read_constdb(void) str_data[n].type=C_INT; else str_data[n].type=C_PARAM; - str_data[n].val=val; + str_data[n].val= (int)strtol(val,NULL,0); } } fclose(fp); |