From bb8ecf9a28a62c24748f736cc75f217e885e595f Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 28 Sep 2006 13:26:40 +0000 Subject: - Merged the necessary changes to make the script engine support negative constants (db/const.txt). Thanks to Rayce (from jA) for the code. - Cleaned up the skill.c code to take into account when skill_unitsetting returns null (skill failed), fixes a possible crash with Wand of Hermode git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8891 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 263e319c1..1210507d6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -408,7 +408,9 @@ static void add_scriptl(int l) add_scriptb(backpatch>>16); break; case C_INT: - add_scripti(str_data[l].val); + add_scripti(abs(str_data[l].val)); + if(str_data[l].val < 0) //Notice that this is negative, from jA (Rayce) + add_scriptc(C_NEG); break; default: // もう他の用途と確定してるので数字をそのまま @@ -1499,8 +1501,8 @@ static void read_constdb(void) if(line[0]=='/' && line[1]=='/') continue; type=0; - 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){ + 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); -- cgit v1.2.3-60-g2f50