summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-16 20:13:19 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-16 20:13:19 +0000
commitdf76ca57e522eeac7391e0cec9e397be38a0d19d (patch)
tree04db16251d383ba587500780baac806d9ff3d392 /src
parente5be0261a4419cb2b6849a751d04477ef40dca79 (diff)
downloadhercules-df76ca57e522eeac7391e0cec9e397be38a0d19d.tar.gz
hercules-df76ca57e522eeac7391e0cec9e397be38a0d19d.tar.bz2
hercules-df76ca57e522eeac7391e0cec9e397be38a0d19d.tar.xz
hercules-df76ca57e522eeac7391e0cec9e397be38a0d19d.zip
- Added support for hexadecimal values in the const.txt file.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8321 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c11
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);