diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-09-28 13:26:40 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-09-28 13:26:40 +0000 |
commit | bb8ecf9a28a62c24748f736cc75f217e885e595f (patch) | |
tree | 8a4ed2e55a3888d23ea005f9fc7d937aab226b32 /src | |
parent | da971e54d636b57b0486c4ba95665d5f8cb26152 (diff) | |
download | hercules-bb8ecf9a28a62c24748f736cc75f217e885e595f.tar.gz hercules-bb8ecf9a28a62c24748f736cc75f217e885e595f.tar.bz2 hercules-bb8ecf9a28a62c24748f736cc75f217e885e595f.tar.xz hercules-bb8ecf9a28a62c24748f736cc75f217e885e595f.zip |
- 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
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 8 | ||||
-rw-r--r-- | src/map/skill.c | 23 |
2 files changed, 17 insertions, 14 deletions
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); diff --git a/src/map/skill.c b/src/map/skill.c index b5c01bf1d..6e36973ce 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6020,15 +6020,15 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s break; case HP_BASILICA: skill_clear_unitgroup(src); - sg = skill_unitsetting(src,skillid,skilllv,x,y,0); - sc_start(src,type,100,skilllv,skill_get_time(skillid,skilllv)); + if ((sg = skill_unitsetting(src,skillid,skilllv,x,y,0))) + sc_start(src,type,100,skilllv,skill_get_time(skillid,skilllv)); flag|=1; break; case CG_HERMODE: skill_clear_unitgroup(src); - sg = skill_unitsetting(src,skillid,skilllv,x,y,0); - sc_start4(src,SC_DANCING,100, - skillid,0,skilllv,sg->group_id,skill_get_time(skillid,skilllv)); + if ((sg = skill_unitsetting(src,skillid,skilllv,x,y,0))) + sc_start4(src,SC_DANCING,100, + skillid,0,skilllv,sg->group_id,skill_get_time(skillid,skilllv)); flag|=1; break; case RG_CLEANER: // [Valaris] @@ -6172,8 +6172,8 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s break; case HW_GRAVITATION: - sg = skill_unitsetting(src,skillid,skilllv,x,y,0); - sc_start4(src,type,100,skilllv,0,BCT_SELF,(int)sg,skill_get_time(skillid,skilllv)); + if ((sg = skill_unitsetting(src,skillid,skilllv,x,y,0))) + sc_start4(src,type,100,skilllv,0,BCT_SELF,(int)sg,skill_get_time(skillid,skilllv)); flag|=1; break; @@ -6199,8 +6199,8 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s case SG_SUN_WARM: case SG_MOON_WARM: case SG_STAR_WARM: - sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); - sc_start4(src,type,100,skilllv,0,0,(int)sg,skill_get_time(skillid,skilllv)); + if ((sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0))) + sc_start4(src,type,100,skilllv,0,0,(int)sg,skill_get_time(skillid,skilllv)); flag|=1; break; @@ -6210,14 +6210,15 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s else { sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); + if (!sg) break; if (sc && sc->data[type].timer != -1) status_change_end(src,type,-1); //Was under someone else's Gospel. [Skotlex] sc_start4(src,type,100,skilllv,0,(int)sg,BCT_SELF,skill_get_time(skillid,skilllv)); } break; case NJ_TATAMIGAESHI: - sc_start(src,type,100,skilllv,skill_get_time2(skillid,skilllv)); - skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); + if (skill_unitsetting(src,skillid,skilllv,src->x,src->y,0)) + sc_start(src,type,100,skilllv,skill_get_time2(skillid,skilllv)); break; case AM_CALLHOMUN: //[orn] |