summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-14 22:04:20 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-14 22:04:20 +0000
commit178e1269471a35507a1965fdb1548f052312a6a3 (patch)
tree1920d8230cd6a54bf04fb96d49cb3d70143139ce /src/map
parent457cff865b0aa35bef85d8440ddf67c95158aa8b (diff)
downloadhercules-178e1269471a35507a1965fdb1548f052312a6a3.tar.gz
hercules-178e1269471a35507a1965fdb1548f052312a6a3.tar.bz2
hercules-178e1269471a35507a1965fdb1548f052312a6a3.tar.xz
hercules-178e1269471a35507a1965fdb1548f052312a6a3.zip
* Removed unconditional redundant status change checks before status_change_end calls (follow up to r12890).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14671 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/map.c90
-rw-r--r--src/map/pc.c30
-rw-r--r--src/map/skill.c54
-rw-r--r--src/map/status.c6
5 files changed, 60 insertions, 122 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 502ecc1e7..5d8062235 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -7615,7 +7615,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
pl_sd->status.manner -= time;
if (pl_sd->status.manner < 0)
sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
- else if (pl_sd->sc.data[SC_NOCHAT])
+ else
status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);
}
return 0;
diff --git a/src/map/map.c b/src/map/map.c
index b5f144838..0ed981c8e 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -393,19 +393,11 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
//TODO: Perhaps some outs of bounds checking should be placed here?
if (bl->type&BL_CHAR) {
skill_unit_move(bl,tick,2);
- sc = status_get_sc(bl);
- if (sc && sc->count) {
- if (sc->data[SC_CLOSECONFINE])
- status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
- if (sc->data[SC_CLOSECONFINE2])
- status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
-// if (sc->data[SC_BLADESTOP]) //Won't stop when you are knocked away, go figure...
-// status_change_end(bl, SC_BLADESTOP, INVALID_TIMER);
- if (sc->data[SC_TATAMIGAESHI])
- status_change_end(bl, SC_TATAMIGAESHI, INVALID_TIMER);
- if (sc->data[SC_MAGICROD])
- status_change_end(bl, SC_MAGICROD, INVALID_TIMER);
- }
+ status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
+ status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
+// status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure...
+ status_change_end(bl, SC_TATAMIGAESHI, INVALID_TIMER);
+ status_change_end(bl, SC_MAGICROD, INVALID_TIMER);
} else
if (bl->type == BL_NPC)
npc_unsetcells((TBL_NPC*)bl);
@@ -1580,64 +1572,40 @@ int map_quit(struct map_session_data *sd)
if( sd->sc.count )
{
//Status that are not saved...
- if(sd->sc.data[SC_BOSSMAPINFO])
- status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
- if(sd->sc.data[SC_AUTOTRADE])
- status_change_end(&sd->bl, SC_AUTOTRADE, INVALID_TIMER);
- if(sd->sc.data[SC_SPURT])
- status_change_end(&sd->bl, SC_SPURT, INVALID_TIMER);
- if(sd->sc.data[SC_BERSERK])
- status_change_end(&sd->bl, SC_BERSERK, INVALID_TIMER);
- if(sd->sc.data[SC_TRICKDEAD])
- status_change_end(&sd->bl, SC_TRICKDEAD, INVALID_TIMER);
- if(sd->sc.data[SC_GUILDAURA])
- status_change_end(&sd->bl, SC_GUILDAURA, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_AUTOTRADE, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SPURT, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_BERSERK, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_TRICKDEAD, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_GUILDAURA, INVALID_TIMER);
if(sd->sc.data[SC_ENDURE] && sd->sc.data[SC_ENDURE]->val4)
status_change_end(&sd->bl, SC_ENDURE, INVALID_TIMER); //No need to save infinite endure.
- if(sd->sc.data[SC_WEIGHT50])
- status_change_end(&sd->bl, SC_WEIGHT50, INVALID_TIMER);
- if(sd->sc.data[SC_WEIGHT90])
- status_change_end(&sd->bl, SC_WEIGHT90, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_WEIGHT50, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_WEIGHT90, INVALID_TIMER);
if (battle_config.debuff_on_logout&1) {
- if(sd->sc.data[SC_ORCISH])
- status_change_end(&sd->bl, SC_ORCISH, INVALID_TIMER);
- if(sd->sc.data[SC_STRIPWEAPON])
- status_change_end(&sd->bl, SC_STRIPWEAPON, INVALID_TIMER);
- if(sd->sc.data[SC_STRIPARMOR])
- status_change_end(&sd->bl, SC_STRIPARMOR, INVALID_TIMER);
- if(sd->sc.data[SC_STRIPSHIELD])
- status_change_end(&sd->bl, SC_STRIPSHIELD, INVALID_TIMER);
- if(sd->sc.data[SC_STRIPHELM])
- status_change_end(&sd->bl, SC_STRIPHELM, INVALID_TIMER);
- if(sd->sc.data[SC_EXTREMITYFIST])
- status_change_end(&sd->bl, SC_EXTREMITYFIST, INVALID_TIMER);
- if(sd->sc.data[SC_EXPLOSIONSPIRITS])
- status_change_end(&sd->bl, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_ORCISH, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_STRIPWEAPON, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_STRIPARMOR, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_STRIPSHIELD, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_STRIPHELM, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_EXTREMITYFIST, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
if(sd->sc.data[SC_REGENERATION] && sd->sc.data[SC_REGENERATION]->val4)
status_change_end(&sd->bl, SC_REGENERATION, INVALID_TIMER);
//TO-DO Probably there are way more NPC_type negative status that are removed
- if(sd->sc.data[SC_CHANGEUNDEAD])
- status_change_end(&sd->bl, SC_CHANGEUNDEAD, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_CHANGEUNDEAD, INVALID_TIMER);
// Both these statuses are removed on logout. [L0ne_W0lf]
- if(sd->sc.data[SC_SLOWCAST])
- status_change_end(&sd->bl, SC_SLOWCAST, INVALID_TIMER);
- if(sd->sc.data[SC_CRITICALWOUND])
- status_change_end(&sd->bl, SC_CRITICALWOUND, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SLOWCAST, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_CRITICALWOUND, INVALID_TIMER);
}
if (battle_config.debuff_on_logout&2)
{
- if(sd->sc.data[SC_MAXIMIZEPOWER])
- status_change_end(&sd->bl, SC_MAXIMIZEPOWER, INVALID_TIMER);
- if(sd->sc.data[SC_MAXOVERTHRUST])
- status_change_end(&sd->bl, SC_MAXOVERTHRUST, INVALID_TIMER);
- if(sd->sc.data[SC_STEELBODY])
- status_change_end(&sd->bl, SC_STEELBODY, INVALID_TIMER);
- if(sd->sc.data[SC_PRESERVE])
- status_change_end(&sd->bl, SC_PRESERVE, INVALID_TIMER);
- if(sd->sc.data[SC_KAAHI])
- status_change_end(&sd->bl, SC_KAAHI, INVALID_TIMER);
- if(sd->sc.data[SC_SPIRIT])
- status_change_end(&sd->bl, SC_SPIRIT, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_MAXIMIZEPOWER, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_MAXOVERTHRUST, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_STEELBODY, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_PRESERVE, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_KAAHI, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SPIRIT, INVALID_TIMER);
}
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 1ce5f0f3b..f745c2f0a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4101,18 +4101,12 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
{ // Cancel some map related stuff.
if (sd->sc.data[SC_JAILED])
return 1; //You may not get out!
- if (sd->sc.data[SC_BOSSMAPINFO])
- status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
- if (sd->sc.data[SC_WARM])
- status_change_end(&sd->bl, SC_WARM, INVALID_TIMER);
- if (sd->sc.data[SC_SUN_COMFORT])
- status_change_end(&sd->bl, SC_SUN_COMFORT, INVALID_TIMER);
- if (sd->sc.data[SC_MOON_COMFORT])
- status_change_end(&sd->bl, SC_MOON_COMFORT, INVALID_TIMER);
- if (sd->sc.data[SC_STAR_COMFORT])
- status_change_end(&sd->bl, SC_STAR_COMFORT, INVALID_TIMER);
- if (sd->sc.data[SC_MIRACLE])
- status_change_end(&sd->bl, SC_MIRACLE, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_WARM, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SUN_COMFORT, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_MOON_COMFORT, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_STAR_COMFORT, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_MIRACLE, INVALID_TIMER);
if (sd->sc.data[SC_KNOWLEDGE]) {
struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE];
if (sce->timer != INVALID_TIMER)
@@ -7241,8 +7235,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
sd->status.weapon = sd->weapontype2;
pc_calcweapontype(sd);
clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
- if(sd->sc.data[SC_DANCING]) //When unequipping, stop dancing. [Skotlex]
- status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER); //When unequipping, stop dancing. [Skotlex]
}
if(sd->status.inventory[n].equip & EQP_HAND_L) {
sd->status.shield = sd->weapontype2 = 0;
@@ -7272,10 +7265,8 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
if(sd->status.inventory[n].equip & EQP_ARMOR) {
// On Armor Change...
- if( sd->sc.data[SC_BENEDICTIO] )
- status_change_end(&sd->bl, SC_BENEDICTIO, INVALID_TIMER);
- if( sd->sc.data[SC_ARMOR_RESIST] )
- status_change_end(&sd->bl, SC_ARMOR_RESIST, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_BENEDICTIO, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_ARMOR_RESIST, INVALID_TIMER);
}
if( sd->state.autobonus&sd->status.inventory[n].equip )
@@ -7735,8 +7726,7 @@ int map_night_timer(int tid, unsigned int tick, int id, intptr data)
void pc_setstand(struct map_session_data *sd){
nullpo_retv(sd);
- if(sd->sc.data[SC_TENSIONRELAX])
- status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER);
//Reset sitting tick.
sd->ssregen.tick.hp = sd->ssregen.tick.sp = 0;
diff --git a/src/map/skill.c b/src/map/skill.c
index cbc4ca385..cd9115df4 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2338,8 +2338,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr data)
} else {
struct status_change *sc = status_get_sc(src);
if(sc) {
- if(sc->data[SC_MAGICPOWER])
- status_change_end(src, SC_MAGICPOWER, INVALID_TIMER);
+ status_change_end(src, SC_MAGICPOWER, INVALID_TIMER);
if(sc->data[SC_SPIRIT] &&
sc->data[SC_SPIRIT]->val2 == SL_WIZARD &&
sc->data[SC_SPIRIT]->val3 == skl->skill_id)
@@ -2662,16 +2661,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
case MO_INVESTIGATE:
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag);
- if (sc && sc->data[SC_BLADESTOP])
- status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
break;
case RG_BACKSTAP:
{
int dir = map_calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl);
if ((!check_distance_bl(src, bl, 0) && !map_check_dir(dir, t_dir)) || bl->type == BL_SKILL) {
- if (sc && sc->data[SC_HIDING])
- status_change_end(src, SC_HIDING, INVALID_TIMER);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag);
dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest]
unit_setdir(bl,dir);
@@ -2688,14 +2685,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
for (i = 1; i < sd->spiritball_old; i++)
skill_addtimerskill(src, tick + i * 200, bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag);
}
- if (sc && sc->data[SC_BLADESTOP])
- status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
break;
case MO_CHAINCOMBO:
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag);
- if (sc && sc->data[SC_BLADESTOP])
- status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
break;
case NJ_ISSEN:
@@ -2991,8 +2986,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
break;
case SL_SMA:
- if (sc && sc->data[SC_SMA])
- status_change_end(src, SC_SMA, INVALID_TIMER);
+ status_change_end(src, SC_SMA, INVALID_TIMER);
case SL_STIN:
case SL_STUN:
if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) {
@@ -3065,8 +3059,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
if (unit_movepos(src, x, y, 0, 0))
clif_slide(src,src->x,src->y);
}
- if (sc && sc->data[SC_HIDING])
- status_change_end(src, SC_HIDING, INVALID_TIMER);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag);
break;
case 0:
@@ -3698,8 +3691,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case NJ_BUNSINJYUTSU:
clif_skill_nodamage(src,bl,skillid,skilllv,
sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)));
- if (tsc && tsc->data[SC_NEN])
- status_change_end(bl, SC_NEN, INVALID_TIMER);
+ status_change_end(bl, SC_NEN, INVALID_TIMER);
break;
/* Was modified to only affect targetted char. [Skotlex]
case HP_ASSUMPTIO:
@@ -3804,12 +3796,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if( tsc && tsc->count )
{
- if( tsc->data[SC_FREEZE] )
- status_change_end(bl, SC_FREEZE, INVALID_TIMER);
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
if( tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE )
status_change_end(bl, SC_STONE, INVALID_TIMER);
- if( tsc->data[SC_SLEEP] )
- status_change_end(bl, SC_SLEEP, INVALID_TIMER);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
}
if( dstmd )
@@ -4642,8 +4632,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case AM_CP_HELM:
{
enum sc_type scid = (sc_type)(SC_STRIPWEAPON + (skillid - AM_CP_WEAPON));
- if(tsc && tsc->data[scid])
- status_change_end(bl, scid, INVALID_TIMER);
+ status_change_end(bl, scid, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,
sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)));
}
@@ -5226,12 +5215,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
unit_skillcastcancel(bl,0);
if(tsc && tsc->count){
- if(tsc->data[SC_FREEZE])
- status_change_end(bl, SC_FREEZE, INVALID_TIMER);
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
if(tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE)
status_change_end(bl, SC_STONE, INVALID_TIMER);
- if(tsc->data[SC_SLEEP])
- status_change_end(bl, SC_SLEEP, INVALID_TIMER);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
}
if(dstmd)
@@ -5298,8 +5285,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
}
for (i=0; i<4; i++) {
- if(tsc->data[SC_STRIPWEAPON + i])
- status_change_end(bl, (sc_type)(SC_STRIPWEAPON + i), INVALID_TIMER);
+ status_change_end(bl, (sc_type)(SC_STRIPWEAPON + i), INVALID_TIMER);
sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skilllv,skilltime);
}
clif_skill_nodamage(src,bl,skillid,skilllv,1);
@@ -5985,10 +5971,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
sc = &sd->sc;
if (sc->count)
{ //End states
- if (sc->data[SC_EXPLOSIONSPIRITS])
- status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
- if (sc->data[SC_BLADESTOP])
- status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
+ status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
}
if (target && target->m == src->m)
{ //Move character to target anyway.
@@ -6409,8 +6393,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
unit_movepos(src, x, y, 1, 0);
clif_slide(src,x,y);
}
- if (sc && sc->data[SC_HIDING])
- status_change_end(src, SC_HIDING, INVALID_TIMER);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
break;
case AM_SPHEREMINE:
case AM_CANNIBALIZE:
@@ -6579,8 +6562,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
return 1;
}
- if (sc && sc->data[SC_MAGICPOWER])
- status_change_end(src, SC_MAGICPOWER, INVALID_TIMER);
+ status_change_end(src, SC_MAGICPOWER, INVALID_TIMER);
if( sd )
{
diff --git a/src/map/status.c b/src/map/status.c
index 21bc9bf92..45fe3a4cf 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -5001,8 +5001,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//TO-DO Blessing and Agi up should do 1 damage against players on Undead Status, even on PvM
//but cannot be plagiarized (this requires aegis investigation on packets and official behavior) [Brainstorm]
if ((!undead_flag && status->race!=RC_DEMON) || bl->type == BL_PC) {
- if (sc->data[SC_CURSE])
- status_change_end(bl, SC_CURSE, INVALID_TIMER);
+ status_change_end(bl, SC_CURSE, INVALID_TIMER);
if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE)
status_change_end(bl, SC_STONE, INVALID_TIMER);
}
@@ -7395,8 +7394,7 @@ int status_change_clear_buffs (struct block_list* bl, int type)
if (type&2) //Debuffs
for( i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++ )
{
- if(sc->data[i])
- status_change_end(bl, (sc_type)i, INVALID_TIMER);
+ status_change_end(bl, (sc_type)i, INVALID_TIMER);
}
for( i = SC_COMMON_MAX+1; i < SC_MAX; i++ )