summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c10
-rw-r--r--src/map/battle.c38
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/clif.c12
-rw-r--r--src/map/homunculus.c4
-rw-r--r--src/map/map.c68
-rw-r--r--src/map/mercenary.c2
-rw-r--r--src/map/mob.c24
-rw-r--r--src/map/npc.c28
-rw-r--r--src/map/pc.c75
-rw-r--r--src/map/pet.c30
-rw-r--r--src/map/script.c22
-rw-r--r--src/map/skill.c207
-rw-r--r--src/map/status.c222
-rw-r--r--src/map/unit.c130
15 files changed, 438 insertions, 436 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 66a8fedb4..502ecc1e7 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1937,7 +1937,7 @@ static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap)
{
TBL_PC* sd = (TBL_PC*)bl;
clif_pvpset(sd, 0, 0, 2);
- if (sd->pvp_timer != -1) {
+ if (sd->pvp_timer != INVALID_TIMER) {
delete_timer(sd->pvp_timer, pc_calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
@@ -1969,7 +1969,7 @@ ACMD_FUNC(pvpoff)
static int atcommand_pvpon_sub(struct block_list *bl,va_list ap)
{
TBL_PC* sd = (TBL_PC*)bl;
- if (sd->pvp_timer == -1) {
+ if (sd->pvp_timer == INVALID_TIMER) {
sd->pvp_timer = add_timer(gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
@@ -6741,7 +6741,7 @@ ACMD_FUNC(unmute)
}
pl_sd->status.manner = 0;
- status_change_end(&pl_sd->bl,SC_NOCHAT,-1);
+ status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);
clif_displaymessage(sd->fd,"Player unmuted");
return 0;
@@ -6815,7 +6815,7 @@ ACMD_FUNC(mute)
sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
} else {
pl_sd->status.manner = 0;
- status_change_end(&pl_sd->bl,SC_NOCHAT,-1);
+ status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);
}
clif_GM_silence(sd, pl_sd, (manner > 0 ? 1 : 0));
@@ -7616,7 +7616,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
if (pl_sd->status.manner < 0)
sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
else if (pl_sd->sc.data[SC_NOCHAT])
- status_change_end(&pl_sd->bl, SC_NOCHAT, -1);
+ status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);
}
return 0;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 32def23f3..3e58c1209 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -160,7 +160,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr data)
struct block_list *target = map_id2bl(dat->target);
if (target && dat && map_id2bl(id) == dat->src && target->prev != NULL && !status_isdead(target) &&
target->m == dat->src->m &&
- (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == -1) &&
+ (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) &&
check_distance_bl(dat->src, target, dat->distance)) //Check to see if you haven't teleported. [Skotlex]
{
map_freeblock_lock();
@@ -263,7 +263,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
if( tsc->data[SC_SPIDERWEB]->val2-- > 0 )
damage <<= 1; // double damage
if( tsc->data[SC_SPIDERWEB]->val2 == 0 )
- status_change_end(target,SC_SPIDERWEB,-1);
+ status_change_end(target, SC_SPIDERWEB, INVALID_TIMER);
}
return damage*ratio/100;
}
@@ -326,7 +326,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
d->dmg_lv = ATK_BLOCK;
return 0;
}
- status_change_end(bl,SC_SAFETYWALL,-1);
+ status_change_end(bl, SC_SAFETYWALL, INVALID_TIMER);
}
if( sc->data[SC_PNEUMA] && (flag&(BF_MAGIC|BF_LONG)) == BF_LONG )
@@ -381,7 +381,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
//Shouldn't end until Breaker's non-weapon part connects.
if (skill_num != ASC_BREAKER || !(flag&BF_WEAPON))
if (--(sce->val3) <= 0) //We make it work like Safety Wall, even though it only blocks 1 time.
- status_change_end(bl, SC_KAUPE, -1);
+ status_change_end(bl, SC_KAUPE, INVALID_TIMER);
return 0;
}
@@ -395,9 +395,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
}
//Both need to be consumed if they are active.
if (sce && --(sce->val2) <= 0)
- status_change_end(bl, SC_UTSUSEMI, -1);
+ status_change_end(bl, SC_UTSUSEMI, INVALID_TIMER);
if ((sce=sc->data[SC_BUNSINJYUTSU]) && --(sce->val2) <= 0)
- status_change_end(bl, SC_BUNSINJYUTSU, -1);
+ status_change_end(bl, SC_BUNSINJYUTSU, INVALID_TIMER);
return 0;
}
@@ -408,7 +408,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
damage <<= 1; // Lex Aeterna only doubles damage of regular attacks from mercenaries
if( skill_num != ASC_BREAKER || !(flag&BF_WEAPON) )
- status_change_end( bl,SC_AETERNA,-1 ); //Shouldn't end until Breaker's non-weapon part connects.
+ status_change_end(bl, SC_AETERNA, INVALID_TIMER); //Shouldn't end until Breaker's non-weapon part connects.
}
//Finally damage reductions....
@@ -464,7 +464,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
per /=20; //Uses 20% SP intervals.
//SP Cost: 1% + 0.5% per every 20% SP
if (!status_charge(bl, 0, (10+5*per)*status->max_sp/1000))
- status_change_end( bl,SC_ENERGYCOAT,-1 );
+ status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER);
//Reduction: 6% + 6% every 20%
damage -= damage * 6 * (1+per) / 100;
}
@@ -484,7 +484,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
status_fix_damage(bl,src,damage,clif_damage(bl,src,gettick(),0,0,damage,0,0,0));
clif_skill_nodamage(bl,bl,ST_REJECTSWORD,sce->val1,1);
if(--(sce->val3)<=0)
- status_change_end(bl, SC_REJECTSWORD, -1);
+ status_change_end(bl, SC_REJECTSWORD, INVALID_TIMER);
}
//Finally Kyrie because it may, or not, reduce damage to 0.
@@ -497,7 +497,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
damage=-sce->val2;
}
if((--sce->val3)<=0 || (sce->val2<=0) || skill_num == AL_HOLYLIGHT)
- status_change_end(bl, SC_KYRIE, -1);
+ status_change_end(bl, SC_KYRIE, INVALID_TIMER);
}
if (!damage) return 0;
@@ -3090,7 +3090,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
if (sc && sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&2))
- status_change_end(src,SC_CLOAKING,-1);
+ status_change_end(src, SC_CLOAKING, INVALID_TIMER);
if( tsc && tsc->data[SC_AUTOCOUNTER] && status_check_skilluse(target, src, KN_AUTOCOUNTER, 1) )
{
@@ -3102,7 +3102,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
int skilllv = tsc->data[SC_AUTOCOUNTER]->val1;
clif_skillcastcancel(target); //Remove the casting bar. [Skotlex]
clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
- status_change_end(target,SC_AUTOCOUNTER,-1);
+ status_change_end(target, SC_AUTOCOUNTER, INVALID_TIMER);
skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skilllv,tick,0);
return ATK_NONE;
}
@@ -3112,7 +3112,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
{
int skilllv = tsc->data[SC_BLADESTOP_WAIT]->val1;
int duration = skill_get_time2(MO_BLADESTOP,skilllv);
- status_change_end(target, SC_BLADESTOP_WAIT, -1);
+ status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
if(sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
{ //Target locked.
clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
@@ -3128,7 +3128,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if (sc && sc->data[SC_SKILLRATE_UP] && sc->data[SC_SKILLRATE_UP]->val1 == MO_TRIPLEATTACK)
{
triple_rate+= triple_rate*(sc->data[SC_SKILLRATE_UP]->val2)/100;
- status_change_end(src,SC_SKILLRATE_UP,-1);
+ status_change_end(src, SC_SKILLRATE_UP, INVALID_TIMER);
}
if (rand()%100 < triple_rate)
//FIXME: invalid return type!
@@ -3142,7 +3142,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
int skilllv = sc->data[SC_SACRIFICE]->val1;
if( --sc->data[SC_SACRIFICE]->val2 <= 0 )
- status_change_end(src, SC_SACRIFICE,-1);
+ status_change_end(src, SC_SACRIFICE, INVALID_TIMER);
status_zap(src, sstatus->max_hp*9/100, 0);//Damage to self is always 9%
@@ -3154,7 +3154,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
return (damage_lv)skill_attack(BF_MAGIC,src,src,target,NPC_MAGICALATTACK,sc->data[SC_MAGICALATTACK]->val1,tick,0);
}
- if(tsc && tsc->data[SC_KAAHI] && tsc->data[SC_KAAHI]->val4 == -1 && tstatus->hp < tstatus->max_hp)
+ if(tsc && tsc->data[SC_KAAHI] && tsc->data[SC_KAAHI]->val4 == INVALID_TIMER && tstatus->hp < tstatus->max_hp)
tsc->data[SC_KAAHI]->val4 = add_timer(tick + skill_get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal.
wd = battle_calc_attack(BF_WEAPON, src, target, 0, 0, flag);
@@ -3197,7 +3197,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
status_fix_damage(NULL, d_bl, damage, 0);
}
else
- status_change_end(target, SC_DEVOTION, -1);
+ status_change_end(target, SC_DEVOTION, INVALID_TIMER);
}
if (sc && sc->data[SC_AUTOSPELL] && rand()%100 < sc->data[SC_AUTOSPELL]->val4) {
@@ -3256,7 +3256,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
--sce->val2;
}
if (sce->val2 <= 0)
- status_change_end(target, SC_POISONREACT, -1);
+ status_change_end(target, SC_POISONREACT, INVALID_TIMER);
}
}
map_freeblock_unlock();
@@ -3344,7 +3344,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
switch( target->type )
{ // Checks on actual target
case BL_PC:
- if (((TBL_PC*)target)->invincible_timer != -1 || pc_isinvisible((TBL_PC*)target))
+ if (((TBL_PC*)target)->invincible_timer != INVALID_TIMER || pc_isinvisible((TBL_PC*)target))
return -1; //Cannot be targeted yet.
break;
case BL_MOB:
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 135c464c4..c4eeea3d9 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1143,7 +1143,7 @@ int chrif_save_scdata(struct map_session_data *sd)
{
if (!sc->data[i])
continue;
- if (sc->data[i]->timer != -1)
+ if (sc->data[i]->timer != INVALID_TIMER)
{
timer = get_timer(sc->data[i]->timer);
if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
diff --git a/src/map/clif.c b/src/map/clif.c
index cdccbd167..b1f1261ed 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9077,7 +9077,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
return;
}
- if (sd->ud.skilltimer != -1 || sd->sc.opt1)
+ if (sd->ud.skilltimer != INVALID_TIMER || sd->sc.opt1)
break;
if (sd->sc.count && (
@@ -9852,7 +9852,7 @@ static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_sess
return;
if( hd->bl.id != target_id && skill_get_inf(skillnum)&INF_SELF_SKILL )
target_id = hd->bl.id;
- if( hd->ud.skilltimer != -1 )
+ if( hd->ud.skilltimer != INVALID_TIMER )
{
if( skillnum != SA_CASTCANCEL ) return;
}
@@ -9962,7 +9962,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
if( target_id < 0 && -target_id == sd->bl.id ) // for disguises [Valaris]
target_id = sd->bl.id;
- if( sd->ud.skilltimer != -1 )
+ if( sd->ud.skilltimer != INVALID_TIMER )
{
if( skillnum != SA_CASTCANCEL )
return;
@@ -10054,7 +10054,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, short skil
safestrncpy(sd->message, (char*)RFIFOP(fd,skillmoreinfo), MESSAGE_SIZE);
}
- if( sd->ud.skilltimer != -1 )
+ if( sd->ud.skilltimer != INVALID_TIMER )
return;
if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 )
@@ -11619,7 +11619,7 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
sc_start(&dstsd->bl,SC_NOCHAT,100,0,0);
} else {
dstsd->status.manner = 0;
- status_change_end(&dstsd->bl,SC_NOCHAT,-1);
+ status_change_end(&dstsd->bl, SC_NOCHAT, INVALID_TIMER);
}
if( type != 2 )
@@ -13272,7 +13272,7 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag)
else
WFIFOB(fd,2) = 2; // First Time
}
- else if (md->spawn_timer != -1)
+ else if (md->spawn_timer != INVALID_TIMER)
{ // Boss is Dead
const struct TimerData * timer_data = get_timer(md->spawn_timer);
unsigned int seconds;
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 4c5717319..7bfb6081d 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -524,7 +524,7 @@ static int merc_hom_hungry(int tid, unsigned int tick, int id, intptr data)
int merc_hom_hungry_timer_delete(struct homun_data *hd)
{
nullpo_ret(hd);
- if(hd->hungry_timer != -1) {
+ if(hd->hungry_timer != INVALID_TIMER) {
delete_timer(hd->hungry_timer,merc_hom_hungry);
hd->hungry_timer = INVALID_TIMER;
}
@@ -638,7 +638,7 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
void merc_hom_init_timers(struct homun_data * hd)
{
- if (hd->hungry_timer == -1)
+ if (hd->hungry_timer == INVALID_TIMER)
hd->hungry_timer = add_timer(gettick()+hd->homunculusDB->hungryDelay,merc_hom_hungry,hd->master->bl.id,0);
hd->regen.state.block = 0; //Restore HP/SP block.
}
diff --git a/src/map/map.c b/src/map/map.c
index d6d8dd657..b5f144838 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -396,15 +396,15 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
sc = status_get_sc(bl);
if (sc && sc->count) {
if (sc->data[SC_CLOSECONFINE])
- status_change_end(bl, SC_CLOSECONFINE, -1);
+ status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
if (sc->data[SC_CLOSECONFINE2])
- status_change_end(bl, SC_CLOSECONFINE2, -1);
+ 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, -1);
+// status_change_end(bl, SC_BLADESTOP, INVALID_TIMER);
if (sc->data[SC_TATAMIGAESHI])
- status_change_end(bl, SC_TATAMIGAESHI, -1);
+ status_change_end(bl, SC_TATAMIGAESHI, INVALID_TIMER);
if (sc->data[SC_MAGICROD])
- status_change_end(bl, SC_MAGICROD, -1);
+ status_change_end(bl, SC_MAGICROD, INVALID_TIMER);
}
} else
if (bl->type == BL_NPC)
@@ -1566,7 +1566,7 @@ int map_quit(struct map_session_data *sd)
return 0;
}
- if (sd->npc_timer_id != -1) //Cancel the event timer.
+ if (sd->npc_timer_id != INVALID_TIMER) //Cancel the event timer.
npc_timerevent_quit(sd);
if (sd->npc_id)
@@ -1581,63 +1581,63 @@ int map_quit(struct map_session_data *sd)
{
//Status that are not saved...
if(sd->sc.data[SC_BOSSMAPINFO])
- status_change_end(&sd->bl,SC_BOSSMAPINFO,-1);
+ status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
if(sd->sc.data[SC_AUTOTRADE])
- status_change_end(&sd->bl,SC_AUTOTRADE,-1);
+ status_change_end(&sd->bl, SC_AUTOTRADE, INVALID_TIMER);
if(sd->sc.data[SC_SPURT])
- status_change_end(&sd->bl,SC_SPURT,-1);
+ status_change_end(&sd->bl, SC_SPURT, INVALID_TIMER);
if(sd->sc.data[SC_BERSERK])
- status_change_end(&sd->bl,SC_BERSERK,-1);
+ status_change_end(&sd->bl, SC_BERSERK, INVALID_TIMER);
if(sd->sc.data[SC_TRICKDEAD])
- status_change_end(&sd->bl,SC_TRICKDEAD,-1);
+ status_change_end(&sd->bl, SC_TRICKDEAD, INVALID_TIMER);
if(sd->sc.data[SC_GUILDAURA])
- status_change_end(&sd->bl,SC_GUILDAURA,-1);
+ 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,-1); //No need to save infinite endure.
+ 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,-1);
+ status_change_end(&sd->bl, SC_WEIGHT50, INVALID_TIMER);
if(sd->sc.data[SC_WEIGHT90])
- status_change_end(&sd->bl,SC_WEIGHT90,-1);
+ 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,-1);
+ status_change_end(&sd->bl, SC_ORCISH, INVALID_TIMER);
if(sd->sc.data[SC_STRIPWEAPON])
- status_change_end(&sd->bl,SC_STRIPWEAPON,-1);
+ status_change_end(&sd->bl, SC_STRIPWEAPON, INVALID_TIMER);
if(sd->sc.data[SC_STRIPARMOR])
- status_change_end(&sd->bl,SC_STRIPARMOR,-1);
+ status_change_end(&sd->bl, SC_STRIPARMOR, INVALID_TIMER);
if(sd->sc.data[SC_STRIPSHIELD])
- status_change_end(&sd->bl,SC_STRIPSHIELD,-1);
+ status_change_end(&sd->bl, SC_STRIPSHIELD, INVALID_TIMER);
if(sd->sc.data[SC_STRIPHELM])
- status_change_end(&sd->bl,SC_STRIPHELM,-1);
+ status_change_end(&sd->bl, SC_STRIPHELM, INVALID_TIMER);
if(sd->sc.data[SC_EXTREMITYFIST])
- status_change_end(&sd->bl,SC_EXTREMITYFIST,-1);
+ status_change_end(&sd->bl, SC_EXTREMITYFIST, INVALID_TIMER);
if(sd->sc.data[SC_EXPLOSIONSPIRITS])
- status_change_end(&sd->bl,SC_EXPLOSIONSPIRITS,-1);
+ 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,-1);
+ 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,-1);
+ 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,-1);
+ status_change_end(&sd->bl, SC_SLOWCAST, INVALID_TIMER);
if(sd->sc.data[SC_CRITICALWOUND])
- status_change_end(&sd->bl,SC_CRITICALWOUND,-1);
+ 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,-1);
+ status_change_end(&sd->bl, SC_MAXIMIZEPOWER, INVALID_TIMER);
if(sd->sc.data[SC_MAXOVERTHRUST])
- status_change_end(&sd->bl,SC_MAXOVERTHRUST,-1);
+ status_change_end(&sd->bl, SC_MAXOVERTHRUST, INVALID_TIMER);
if(sd->sc.data[SC_STEELBODY])
- status_change_end(&sd->bl,SC_STEELBODY,-1);
+ status_change_end(&sd->bl, SC_STEELBODY, INVALID_TIMER);
if(sd->sc.data[SC_PRESERVE])
- status_change_end(&sd->bl,SC_PRESERVE,-1);
+ status_change_end(&sd->bl, SC_PRESERVE, INVALID_TIMER);
if(sd->sc.data[SC_KAAHI])
- status_change_end(&sd->bl,SC_KAAHI,-1);
+ status_change_end(&sd->bl, SC_KAAHI, INVALID_TIMER);
if(sd->sc.data[SC_SPIRIT])
- status_change_end(&sd->bl,SC_SPIRIT,-1);
+ status_change_end(&sd->bl, SC_SPIRIT, INVALID_TIMER);
}
}
@@ -2109,7 +2109,7 @@ int map_addmobtolist(unsigned short m, struct spawn_data *spawn)
void map_spawnmobs(int m)
{
int i, k=0;
- if (map[m].mob_delete_timer != -1)
+ if (map[m].mob_delete_timer != INVALID_TIMER)
{ //Mobs have not been removed yet [Skotlex]
delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
map[m].mob_delete_timer = INVALID_TIMER;
@@ -2184,7 +2184,7 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr data)
void map_removemobs(int m)
{
- if (map[m].mob_delete_timer != -1) // should never happen
+ if (map[m].mob_delete_timer != INVALID_TIMER) // should never happen
return; //Mobs are already scheduled for removal
map[m].mob_delete_timer = add_timer(gettick()+battle_config.mob_remove_delay, map_removemobs_timer, m, 0);
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 2cf729e80..8300628d5 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -250,7 +250,7 @@ int merc_delete(struct mercenary_data *md, int reply)
if( md->devotion_flag )
{
md->devotion_flag = 0;
- status_change_end(&sd->bl, SC_DEVOTION, -1);
+ status_change_end(&sd->bl, SC_DEVOTION, INVALID_TIMER);
}
switch( reply )
diff --git a/src/map/mob.c b/src/map/mob.c
index 8bde6a538..6135850b6 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1183,7 +1183,7 @@ int mob_unlocktarget(struct mob_data *md, unsigned int tick)
switch (md->state.skillstate) {
case MSS_WALK:
- if (md->ud.walktimer != -1)
+ if (md->ud.walktimer != INVALID_TIMER)
break;
//Because it is not unset when the mob finishes walking.
md->state.skillstate = MSS_IDLE;
@@ -1274,7 +1274,7 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
if (target->m == md->bl.m && check_distance_bl(&md->bl, target, AREA_SIZE))
return 0; //No need to do a warp chase.
- if (md->ud.walktimer != -1 &&
+ if (md->ud.walktimer != INVALID_TIMER &&
map_getcell(md->bl.m,md->ud.to_x,md->ud.to_y,CELL_CHKNPC))
return 1; //Already walking to a warp.
@@ -1306,10 +1306,10 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
md->last_thinktime = tick;
- if (md->ud.skilltimer != -1)
+ if (md->ud.skilltimer != INVALID_TIMER)
return false;
- if(md->ud.walktimer != -1 && md->ud.walkpath.path_pos <= 3)
+ if(md->ud.walktimer != INVALID_TIMER && md->ud.walkpath.path_pos <= 3)
return false;
// Abnormalities
@@ -1331,8 +1331,8 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
{ //Check validity of current target. [Skotlex]
tbl = map_id2bl(md->target_id);
if (!tbl || tbl->m != md->bl.m ||
- (md->ud.attacktimer == -1 && !status_check_skilluse(&md->bl, tbl, 0, 0)) ||
- (md->ud.walktimer != -1 && !(battle_config.mob_ai&0x1) && !check_distance_bl(&md->bl, tbl, md->min_chase)) ||
+ (md->ud.attacktimer == INVALID_TIMER && !status_check_skilluse(&md->bl, tbl, 0, 0)) ||
+ (md->ud.walktimer != INVALID_TIMER && !(battle_config.mob_ai&0x1) && !check_distance_bl(&md->bl, tbl, md->min_chase)) ||
(
tbl->type == BL_PC &&
((((TBL_PC*)tbl)->state.gangsterparadise && !(mode&MD_BOSS)) ||
@@ -1447,7 +1447,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
if (tbl->type == BL_ITEM)
{ //Loot time.
struct flooritem_data *fitem;
- if (md->ud.target == tbl->id && md->ud.walktimer != -1)
+ if (md->ud.target == tbl->id && md->ud.walktimer != INVALID_TIMER)
return true; //Already locked.
if (md->lootitem == NULL)
{ //Can't loot...
@@ -1469,7 +1469,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
return true;
}
//Within looting range.
- if (md->ud.attacktimer != -1)
+ if (md->ud.attacktimer != INVALID_TIMER)
return true; //Busy attacking?
fitem = (struct flooritem_data *)tbl;
@@ -1497,7 +1497,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
}
//Attempt to attack.
//At this point we know the target is attackable, we just gotta check if the range matches.
- if (md->ud.target == tbl->id && md->ud.attacktimer != -1) //Already locked.
+ if (md->ud.target == tbl->id && md->ud.attacktimer != INVALID_TIMER) //Already locked.
return true;
if (battle_check_range (&md->bl, tbl, md->status.rhw.range))
@@ -1526,7 +1526,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
return true;
}
- if (md->ud.walktimer != -1 && md->ud.target == tbl->id &&
+ if (md->ud.walktimer != INVALID_TIMER && md->ud.target == tbl->id &&
(
!(battle_config.mob_ai&0x1) ||
check_distance_blxy(tbl, md->ud.to_x, md->ud.to_y, md->status.rhw.range)
@@ -2432,7 +2432,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
md->status.hp = 1;
}
- if(md->deletetimer!=-1) {
+ if(md->deletetimer != INVALID_TIMER) {
delete_timer(md->deletetimer,mob_timer_delete);
md->deletetimer = INVALID_TIMER;
}
@@ -2900,7 +2900,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
nullpo_ret(md);
nullpo_ret(ms = md->db->skill);
- if (!battle_config.mob_skill_rate || md->ud.skilltimer != -1 || !md->db->maxskill)
+ if (!battle_config.mob_skill_rate || md->ud.skilltimer != INVALID_TIMER || !md->db->maxskill)
return 0;
if (event == -1 && DIFF_TICK(md->ud.canact_tick, tick) > 0)
diff --git a/src/map/npc.c b/src/map/npc.c
index b8fd5712c..1bf5bd312 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -493,10 +493,10 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr data)
else
{
if( sd )
- sd->npc_timer_id = -1;
+ sd->npc_timer_id = INVALID_TIMER;
else
{
- nd->u.scr.timerid = -1;
+ nd->u.scr.timerid = INVALID_TIMER;
nd->u.scr.timertick = 0; // NPC timer stopped
}
ers_free(timer_event_ers, ted);
@@ -544,10 +544,10 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
// Check if timer is already started.
if( sd )
{
- if( sd->npc_timer_id != -1 )
+ if( sd->npc_timer_id != INVALID_TIMER )
return 0;
}
- else if( nd->u.scr.timerid != -1 )
+ else if( nd->u.scr.timerid != INVALID_TIMER )
return 0;
// Arrange for the next event
@@ -587,7 +587,7 @@ int npc_timerevent_stop(struct npc_data* nd)
}
tid = sd?&sd->npc_timer_id:&nd->u.scr.timerid;
- if( *tid == -1 ) // Nothing to stop
+ if( *tid == INVALID_TIMER ) // Nothing to stop
return 0;
// Delete timer
@@ -595,7 +595,7 @@ int npc_timerevent_stop(struct npc_data* nd)
if( td && td->data )
ers_free(timer_event_ers, (void*)td->data);
delete_timer(*tid,npc_timerevent);
- *tid = -1;
+ *tid = INVALID_TIMER;
if( !sd )
{
@@ -615,11 +615,11 @@ void npc_timerevent_quit(struct map_session_data* sd)
struct timer_event_data *ted;
// Check timer existance
- if( sd->npc_timer_id == -1 )
+ if( sd->npc_timer_id == INVALID_TIMER )
return;
if( !(td = get_timer(sd->npc_timer_id)) )
{
- sd->npc_timer_id = -1;
+ sd->npc_timer_id = INVALID_TIMER;
return;
}
@@ -627,7 +627,7 @@ void npc_timerevent_quit(struct map_session_data* sd)
nd = (struct npc_data *)map_id2bl(td->id);
ted = (struct timer_event_data*)td->data;
delete_timer(sd->npc_timer_id, npc_timerevent);
- sd->npc_timer_id = -1;
+ sd->npc_timer_id = INVALID_TIMER;
// Execute OnTimerQuit
if( nd && nd->bl.type == BL_NPC )
@@ -873,7 +873,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y)
{ // failed to run OnTouch event, so just click the npc
struct unit_data *ud = unit_bl2ud(&sd->bl);
if( ud && ud->walkpath.path_pos < ud->walkpath.path_len )
- { // Since walktimer always == -1 at this time, we stop walking manually. [Inkfish]
+ { // Since walktimer always == INVALID_TIMER at this time, we stop walking manually. [Inkfish]
clif_fixpos(&sd->bl);
ud->walkpath.path_pos = ud->walkpath.path_len;
}
@@ -1600,7 +1600,7 @@ int npc_unload(struct npc_data* nd)
}
mapit_free(iter);
- if (nd->u.scr.timerid != -1) {
+ if (nd->u.scr.timerid != INVALID_TIMER) {
const struct TimerData *td = NULL;
td = get_timer(nd->u.scr.timerid);
if (td && td->data)
@@ -2245,7 +2245,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
nd->u.scr.timeramount++;
}
}
- nd->u.scr.timerid = -1;
+ nd->u.scr.timerid = INVALID_TIMER;
return end;
}
@@ -2428,7 +2428,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
nd->u.scr.timeramount++;
}
}
- nd->u.scr.timerid = -1;
+ nd->u.scr.timerid = INVALID_TIMER;
return end;
}
@@ -3536,7 +3536,7 @@ int do_init_npc(void)
fake_nd->subtype = SCRIPT;
strdb_put(npcname_db, fake_nd->exname, fake_nd);
- fake_nd->u.scr.timerid = -1;
+ fake_nd->u.scr.timerid = INVALID_TIMER;
map_addiddb(&fake_nd->bl);
// End of initialization
diff --git a/src/map/pc.c b/src/map/pc.c
index 59b0cfd11..1ce5f0f3b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -170,7 +170,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max)
if( sd->spiritball && sd->spiritball >= max )
{
- if(sd->spirit_timer[0] != -1)
+ if(sd->spirit_timer[0] != INVALID_TIMER)
delete_timer(sd->spirit_timer[0],pc_spiritball_timer);
sd->spiritball--;
if( sd->spiritball != 0 )
@@ -209,14 +209,14 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type)
count = MAX_SKILL_LEVEL;
for(i=0;i<count;i++) {
- if(sd->spirit_timer[i] != -1) {
+ if(sd->spirit_timer[i] != INVALID_TIMER) {
delete_timer(sd->spirit_timer[i],pc_spiritball_timer);
- sd->spirit_timer[i] = -1;
+ sd->spirit_timer[i] = INVALID_TIMER;
}
}
for(i=count;i<MAX_SKILL_LEVEL;i++) {
sd->spirit_timer[i-count] = sd->spirit_timer[i];
- sd->spirit_timer[i] = -1;
+ sd->spirit_timer[i] = INVALID_TIMER;
}
if(!type)
@@ -317,7 +317,7 @@ int pc_inventory_rental_clear(struct map_session_data *sd)
if( sd->rental_timer != INVALID_TIMER )
{
delete_timer(sd->rental_timer, pc_inventory_rental_end);
- sd->rental_timer = -1;
+ sd->rental_timer = INVALID_TIMER;
}
return 1;
@@ -912,7 +912,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
// Event Timers
for( i = 0; i < MAX_EVENTTIMER; i++ )
- sd->eventtimer[i] = -1;
+ sd->eventtimer[i] = INVALID_TIMER;
// Rental Timer
sd->rental_timer = INVALID_TIMER;
@@ -1418,9 +1418,9 @@ int pc_updateweightstatus(struct map_session_data *sd)
// stop old status change
if( old_overweight == 1 )
- status_change_end(&sd->bl, SC_WEIGHT50, -1);
+ status_change_end(&sd->bl, SC_WEIGHT50, INVALID_TIMER);
else if( old_overweight == 2 )
- status_change_end(&sd->bl, SC_WEIGHT90, -1);
+ status_change_end(&sd->bl, SC_WEIGHT90, INVALID_TIMER);
// start new status change
if( new_overweight == 1 )
@@ -3706,7 +3706,7 @@ int pc_useitem(struct map_session_data *sd,int n)
//perform a skill-use check before going through. [Skotlex]
//resurrection was picked as testing skill, as a non-offensive, generic skill, it will do.
//FIXME: Is this really needed here? It'll be checked in unit.c after all and this prevents skill items using when silenced [Inkfish]
- if( sd->inventory_data[n]->flag.delay_consume && ( sd->ud.skilltimer != -1 /*|| !status_check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) )
+ if( sd->inventory_data[n]->flag.delay_consume && ( sd->ud.skilltimer != INVALID_TIMER /*|| !status_check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) )
return 0;
if( sd->inventory_data[n]->delay > 0 ) { // Check if there is a delay on this item [Paradox924X]
@@ -4102,20 +4102,20 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
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,-1);
+ status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
if (sd->sc.data[SC_WARM])
- status_change_end(&sd->bl,SC_WARM,-1);
+ status_change_end(&sd->bl, SC_WARM, INVALID_TIMER);
if (sd->sc.data[SC_SUN_COMFORT])
- status_change_end(&sd->bl,SC_SUN_COMFORT,-1);
+ 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,-1);
+ 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,-1);
+ status_change_end(&sd->bl, SC_STAR_COMFORT, INVALID_TIMER);
if (sd->sc.data[SC_MIRACLE])
- status_change_end(&sd->bl,SC_MIRACLE,-1);
+ 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 != -1)
+ if (sce->timer != INVALID_TIMER)
delete_timer(sce->timer, status_change_timer);
sce->timer = add_timer(gettick() + skill_get_time(SG_KNOWLEDGE, sce->val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE);
}
@@ -4387,17 +4387,17 @@ int pc_checkallowskill(struct map_session_data *sd)
{ // Skills requiring specific weapon types
if(sd->sc.data[scw_list[i]] &&
!pc_check_weapontype(sd,skill_get_weapontype(status_sc2skill(scw_list[i]))))
- status_change_end(&sd->bl,scw_list[i],-1);
+ status_change_end(&sd->bl, scw_list[i], INVALID_TIMER);
}
if(sd->sc.data[SC_SPURT] && sd->status.weapon)
// Spurt requires bare hands (feet, in fact xD)
- status_change_end(&sd->bl,SC_SPURT,-1);
+ status_change_end(&sd->bl, SC_SPURT, INVALID_TIMER);
if(sd->status.shield <= 0) { // Skills requiring a shield
for (i = 0; i < ARRAYLENGTH(scs_list); i++)
if(sd->sc.data[scs_list[i]])
- status_change_end(&sd->bl,scs_list[i],-1);
+ status_change_end(&sd->bl, scs_list[i], INVALID_TIMER);
}
return 0;
}
@@ -4759,7 +4759,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr data)
// either player or target is currently detached from map blocks (could be teleporting),
// but still connected to this map, so we'll just increment the timer and check back later
if (sd->bl.prev != NULL && tbl->prev != NULL &&
- sd->ud.skilltimer == -1 && sd->ud.attacktimer == -1 && sd->ud.walktimer == -1)
+ sd->ud.skilltimer == INVALID_TIMER && sd->ud.attacktimer == INVALID_TIMER && sd->ud.walktimer == INVALID_TIMER)
{
if((sd->bl.m == tbl->m) && unit_can_reach_bl(&sd->bl,tbl, AREA_SIZE, 0, NULL, NULL)) {
if (!check_distance_bl(&sd->bl, tbl, 5))
@@ -4791,11 +4791,11 @@ int pc_follow(struct map_session_data *sd,int target_id)
struct block_list *bl = map_id2bl(target_id);
if (bl == NULL /*|| bl->type != BL_PC*/)
return 1;
- if (sd->followtimer != -1)
+ if (sd->followtimer != INVALID_TIMER)
pc_stop_following(sd);
sd->followtarget = target_id;
- pc_follow_timer(-1,gettick(),sd->bl.id,0);
+ pc_follow_timer(INVALID_TIMER, gettick(), sd->bl.id, 0);
return 0;
}
@@ -5641,7 +5641,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
for(k = 0; k < 5; k++)
if (sd->devotion[k]){
struct map_session_data *devsd = map_id2sd(sd->devotion[k]);
- if (devsd) status_change_end(&devsd->bl,SC_DEVOTION,-1);
+ if (devsd)
+ status_change_end(&devsd->bl, SC_DEVOTION, INVALID_TIMER);
sd->devotion[k] = 0;
}
@@ -5795,7 +5796,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,status_skill2sc(MO_STEELBODY),100,1,skill_get_time(MO_STEELBODY,1));
if(map_flag_gvg(sd->bl.m))
- pc_respawn_timer(-1, gettick(), sd->bl.id, 0);
+ pc_respawn_timer(INVALID_TIMER, gettick(), sd->bl.id, 0);
return 0;
}
}
@@ -6293,7 +6294,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
//Remove status specific to your current tree skills.
enum sc_type sc = status_skill2sc(id);
if (sc > SC_COMMON_MAX && sd->sc.data[sc])
- status_change_end(&sd->bl, sc, -1);
+ status_change_end(&sd->bl, sc, INVALID_TIMER);
}
}
@@ -6939,7 +6940,7 @@ static int pc_eventtimer(int tid, unsigned int tick, int id, intptr data)
ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] == tid );
if( i < MAX_EVENTTIMER )
{
- sd->eventtimer[i] = -1;
+ sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
npc_event(sd,p,0);
}
@@ -6958,7 +6959,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name)
int i;
nullpo_ret(sd);
- ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] == -1 );
+ ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] == INVALID_TIMER );
if( i == MAX_EVENTTIMER )
return 0;
@@ -6983,7 +6984,7 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name)
// find the named event timer
ARR_FIND( 0, MAX_EVENTTIMER, i,
- sd->eventtimer[i] != -1 &&
+ sd->eventtimer[i] != INVALID_TIMER &&
(p = (char *)(get_timer(sd->eventtimer[i])->data)) != NULL &&
strcmp(p, name) == 0
);
@@ -6991,7 +6992,7 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name)
return 0; // not found
delete_timer(sd->eventtimer[i],pc_eventtimer);
- sd->eventtimer[i]=-1;
+ sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
aFree(p);
@@ -7008,7 +7009,7 @@ int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick)
nullpo_ret(sd);
for(i=0;i<MAX_EVENTTIMER;i++)
- if( sd->eventtimer[i]!=-1 && strcmp(
+ if( sd->eventtimer[i] != INVALID_TIMER && strcmp(
(char *)(get_timer(sd->eventtimer[i])->data), name)==0 ){
addtick_timer(sd->eventtimer[i],tick);
break;
@@ -7030,10 +7031,10 @@ int pc_cleareventtimer(struct map_session_data *sd)
return 0;
for(i=0;i<MAX_EVENTTIMER;i++)
- if( sd->eventtimer[i]!=-1 ){
+ if( sd->eventtimer[i] != INVALID_TIMER ){
char *p = (char *)(get_timer(sd->eventtimer[i])->data);
delete_timer(sd->eventtimer[i],pc_eventtimer);
- sd->eventtimer[i]=-1;
+ sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
if (p) aFree(p);
}
@@ -7241,7 +7242,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
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, -1);
+ status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER);
}
if(sd->status.inventory[n].equip & EQP_HAND_L) {
sd->status.shield = sd->weapontype2 = 0;
@@ -7272,9 +7273,9 @@ 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, -1);
+ status_change_end(&sd->bl, SC_BENEDICTIO, INVALID_TIMER);
if( sd->sc.data[SC_ARMOR_RESIST] )
- status_change_end(&sd->bl, SC_ARMOR_RESIST, -1);
+ status_change_end(&sd->bl, SC_ARMOR_RESIST, INVALID_TIMER);
}
if( sd->state.autobonus&sd->status.inventory[n].equip )
@@ -7288,7 +7289,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
}
if(sd->sc.data[SC_SIGNUMCRUCIS] && !battle_check_undead(sd->battle_status.race,sd->battle_status.def_ele))
- status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
+ status_change_end(&sd->bl, SC_SIGNUMCRUCIS, INVALID_TIMER);
//OnUnEquip script [Skotlex]
if (sd->inventory_data[n]) {
@@ -7735,7 +7736,7 @@ void pc_setstand(struct map_session_data *sd){
nullpo_retv(sd);
if(sd->sc.data[SC_TENSIONRELAX])
- status_change_end(&sd->bl,SC_TENSIONRELAX,-1);
+ 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/pet.c b/src/map/pet.c
index 6af48f3dd..6b16fe888 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -180,7 +180,7 @@ int pet_sc_check(struct map_session_data *sd, int type)
if( pd == NULL
|| (battle_config.pet_equip_required && pd->pet.equip == 0)
|| pd->recovery == NULL
- || pd->recovery->timer != -1
+ || pd->recovery->timer != INVALID_TIMER
|| pd->recovery->type != type )
return 1;
@@ -263,7 +263,7 @@ int search_petDB_index(int key,int type)
int pet_hungry_timer_delete(struct pet_data *pd)
{
nullpo_ret(pd);
- if(pd->pet_hungry_timer != -1) {
+ if(pd->pet_hungry_timer != INVALID_TIMER) {
delete_timer(pd->pet_hungry_timer,pet_hungry);
pd->pet_hungry_timer = INVALID_TIMER;
}
@@ -666,14 +666,14 @@ int pet_equipitem(struct map_session_data *sd,int index)
if (battle_config.pet_equip_required)
{ //Skotlex: start support timers if need
unsigned int tick = gettick();
- if (pd->s_skill && pd->s_skill->timer == -1)
+ if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER)
{
if (pd->s_skill->id)
pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000, pet_skill_support_timer, sd->bl.id, 0);
else
pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000, pet_heal_timer, sd->bl.id, 0);
}
- if (pd->bonus && pd->bonus->timer == -1)
+ if (pd->bonus && pd->bonus->timer == INVALID_TIMER)
pd->bonus->timer=add_timer(tick+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
}
@@ -706,7 +706,7 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
pd->state.skillbonus = 0;
status_calc_pc(sd,0);
}
- if( pd->s_skill && pd->s_skill->timer != -1 )
+ if( pd->s_skill && pd->s_skill->timer != INVALID_TIMER )
{
if( pd->s_skill->id )
delete_timer(pd->s_skill->timer, pet_skill_support_timer);
@@ -714,7 +714,7 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
delete_timer(pd->s_skill->timer, pet_heal_timer);
pd->s_skill->timer = INVALID_TIMER;
}
- if( pd->bonus && pd->bonus->timer != -1 )
+ if( pd->bonus && pd->bonus->timer != INVALID_TIMER )
{
delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
pd->bonus->timer = INVALID_TIMER;
@@ -825,10 +825,10 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
return 0;
pd->last_thinktime=tick;
- if(pd->ud.attacktimer != -1 || pd->ud.skilltimer != -1 || pd->bl.m != sd->bl.m)
+ if(pd->ud.attacktimer != INVALID_TIMER || pd->ud.skilltimer != INVALID_TIMER || pd->bl.m != sd->bl.m)
return 0;
- if(pd->ud.walktimer != -1 && pd->ud.walkpath.path_pos <= 2)
+ if(pd->ud.walktimer != INVALID_TIMER && pd->ud.walkpath.path_pos <= 2)
return 0; //No thinking when you just started to walk.
if(pd->pet.intimate <= 0) {
@@ -841,7 +841,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
//Master too far, chase.
if(pd->target_id)
pet_unlocktarget(pd);
- if(pd->ud.walktimer != -1 && pd->ud.target == sd->bl.id)
+ if(pd->ud.walktimer != INVALID_TIMER && pd->ud.target == sd->bl.id)
return 0; //Already walking to him
if (DIFF_TICK(tick, pd->ud.canmove_tick) < 0)
return 0; //Can't move yet.
@@ -855,7 +855,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
//Return speed to normal.
if (pd->status.speed != pd->petDB->speed) {
- if (pd->ud.walktimer != -1)
+ if (pd->ud.walktimer != INVALID_TIMER)
return 0; //Wait until the pet finishes walking back to master.
pd->status.speed = pd->petDB->speed;
}
@@ -881,7 +881,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
if (check_distance_bl(&sd->bl, &pd->bl, 3))
return 0; //Already next to master.
- if(pd->ud.walktimer != -1 && check_distance_blxy(&sd->bl, pd->ud.to_x,pd->ud.to_y, 3))
+ if(pd->ud.walktimer != INVALID_TIMER && check_distance_blxy(&sd->bl, pd->ud.to_x,pd->ud.to_y, 3))
return 0; //Already walking to him
unit_calc_pos(&pd->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
@@ -892,7 +892,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
}
if(pd->ud.target == target->id &&
- (pd->ud.attacktimer != -1 || pd->ud.walktimer != -1))
+ (pd->ud.attacktimer != INVALID_TIMER || pd->ud.walktimer != INVALID_TIMER))
return 0; //Target already locked.
if (target->type != BL_ITEM)
@@ -1099,7 +1099,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr data)
{ //Display a heal animation?
//Detoxify is chosen for now.
clif_skill_nodamage(&pd->bl,&sd->bl,TF_DETOXIFY,1,1);
- status_change_end(&sd->bl,pd->recovery->type,-1);
+ status_change_end(&sd->bl, pd->recovery->type, INVALID_TIMER);
clif_emotion(&pd->bl, E_OK);
}
@@ -1130,7 +1130,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr data)
if(pc_isdead(sd) ||
(rate = get_percentage(status->sp, status->max_sp)) > pd->s_skill->sp ||
(rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
- (rate = (pd->ud.skilltimer != -1)) //Another skill is in effect
+ (rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
pd->s_skill->timer=add_timer(gettick()+(rate>10?rate:10)*100,pet_heal_timer,sd->bl.id,0);
return 0;
@@ -1173,7 +1173,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr data)
if(pc_isdead(sd) ||
(rate = get_percentage(status->sp, status->max_sp)) > pd->s_skill->sp ||
(rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
- (rate = (pd->ud.skilltimer != -1)) //Another skill is in effect
+ (rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
pd->s_skill->timer=add_timer(tick+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);
return 0;
diff --git a/src/map/script.c b/src/map/script.c
index 520fbfdd4..62462ce66 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3261,7 +3261,7 @@ int run_script_timer(int tid, unsigned int tick, int id, intptr data)
st->rid = 0;
st->state = END;
}
- while( node && st->sleep.timer != -1 ) {
+ while( node && st->sleep.timer != INVALID_TIMER ) {
if( (int)node->key == st->oid && ((struct script_state *)node->data)->sleep.timer == st->sleep.timer ) {
script_erase_sleepdb(node);
st->sleep.timer = INVALID_TIMER;
@@ -8348,10 +8348,10 @@ BUILDIN_FUNC(getnpctimer)
ShowError("buildin_getnpctimer: Attached player not found!\n");
break;
}
- val = (sd->npc_timer_id != -1);
+ val = (sd->npc_timer_id != INVALID_TIMER);
}
else
- val = (nd->u.scr.timerid !=-1);
+ val = (nd->u.scr.timerid != INVALID_TIMER);
break;
case 2: val = nd->u.scr.timeramount; break;
}
@@ -9732,7 +9732,7 @@ BUILDIN_FUNC(pvpon)
iter = mapit_getallusers();
for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
{
- if( sd->bl.m != m || sd->pvp_timer != -1 )
+ if( sd->bl.m != m || sd->pvp_timer != INVALID_TIMER )
continue; // not applicable
sd->pvp_timer = add_timer(gettick()+200,pc_calc_pvprank_timer,sd->bl.id,0);
@@ -9751,7 +9751,7 @@ static int buildin_pvpoff_sub(struct block_list *bl,va_list ap)
{
TBL_PC* sd = (TBL_PC*)bl;
clif_pvpset(sd, 0, 0, 2);
- if (sd->pvp_timer != -1) {
+ if (sd->pvp_timer != INVALID_TIMER) {
delete_timer(sd->pvp_timer, pc_calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
@@ -10836,7 +10836,7 @@ BUILDIN_FUNC(petskillbonus)
pd=sd->pd;
if (pd->bonus)
{ //Clear previous bonus
- if (pd->bonus->timer != -1)
+ if (pd->bonus->timer != INVALID_TIMER)
delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
} else //init
pd->bonus = (struct pet_bonus *) aMalloc(sizeof(struct pet_bonus));
@@ -11189,7 +11189,7 @@ BUILDIN_FUNC(petrecovery)
if (pd->recovery)
{ //Halt previous bonus
- if (pd->recovery->timer != -1)
+ if (pd->recovery->timer != INVALID_TIMER)
delete_timer(pd->recovery->timer, pet_recovery_timer);
} else //Init
pd->recovery = (struct pet_recovery *)aMalloc(sizeof(struct pet_recovery));
@@ -11215,7 +11215,7 @@ BUILDIN_FUNC(petheal)
pd=sd->pd;
if (pd->s_skill)
{ //Clear previous skill
- if (pd->s_skill->timer != -1)
+ if (pd->s_skill->timer != INVALID_TIMER)
{
if (pd->s_skill->id)
delete_timer(pd->s_skill->timer, pet_skill_support_timer);
@@ -11309,7 +11309,7 @@ BUILDIN_FUNC(petskillsupport)
pd=sd->pd;
if (pd->s_skill)
{ //Clear previous skill
- if (pd->s_skill->timer != -1)
+ if (pd->s_skill->timer != INVALID_TIMER)
{
if (pd->s_skill->id)
delete_timer(pd->s_skill->timer, pet_skill_support_timer);
@@ -13584,7 +13584,7 @@ BUILDIN_FUNC(awake)
struct script_state* tst = (struct script_state*)node->data;
TBL_PC* sd = map_id2sd(tst->rid);
- if( tst->sleep.timer == -1 )
+ if( tst->sleep.timer == INVALID_TIMER )
{// already awake ???
node = node->next;
continue;
@@ -14617,7 +14617,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
if( md->class_ != mobid )
return 0;
- if( md->ud.skilltimer != -1 ) // Cancel the casting skill.
+ if( md->ud.skilltimer != INVALID_TIMER ) // Cancel the casting skill.
unit_skillcastcancel(bl,0);
// 0:self, 1:target, 2:master, default:random
diff --git a/src/map/skill.c b/src/map/skill.c
index 6b63c2b83..cbc4ca385 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -611,7 +611,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
rate = 20;
if (sc->data[SC_SKILLRATE_UP] && sc->data[SC_SKILLRATE_UP]->val1 == TK_COUNTER) {
rate += rate*sc->data[SC_SKILLRATE_UP]->val2/100;
- status_change_end(src,SC_SKILLRATE_UP,-1);
+ status_change_end(src, SC_SKILLRATE_UP, INVALID_TIMER);
}
sc_start4(src,SC_COMBO, rate, TK_COUNTER, bl->id,0,0,
(2000 - 4*sstatus->agi - 2*sstatus->dex));
@@ -883,12 +883,12 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case TK_JUMPKICK:
if( dstsd && dstsd->class_ != MAPID_SOUL_LINKER && !tsc->data[SC_PRESERVE] )
{// debuff the following statuses
- status_change_end(bl, SC_SPIRIT, -1);
- status_change_end(bl, SC_ADRENALINE2, -1);
- status_change_end(bl, SC_KAITE, -1);
- status_change_end(bl, SC_KAAHI, -1);
- status_change_end(bl, SC_ONEHAND, -1);
- status_change_end(bl, SC_ASPDPOTION2, -1);
+ status_change_end(bl, SC_SPIRIT, INVALID_TIMER);
+ status_change_end(bl, SC_ADRENALINE2, INVALID_TIMER);
+ status_change_end(bl, SC_KAITE, INVALID_TIMER);
+ status_change_end(bl, SC_KAAHI, INVALID_TIMER);
+ status_change_end(bl, SC_ONEHAND, INVALID_TIMER);
+ status_change_end(bl, SC_ASPDPOTION2, INVALID_TIMER);
}
break;
case TK_TURNKICK:
@@ -1544,7 +1544,7 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in
{// Kaite only works against non-players if they are low-level.
clif_specialeffect(bl, 438, AREA);
if( --sc->data[SC_KAITE]->val2 <= 0 )
- status_change_end(bl, SC_KAITE, -1);
+ status_change_end(bl, SC_KAITE, INVALID_TIMER);
return 2;
}
@@ -1719,7 +1719,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
break;
default:
if( src == dsrc ) // Ground skills are exceptions. [Inkfish]
- status_change_end(src,SC_COMBO,-1);
+ status_change_end(src, SC_COMBO, INVALID_TIMER);
}
}
switch(skillid)
@@ -1904,7 +1904,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
status_fix_damage(NULL, d_bl, damage, 0);
}
else
- status_change_end(bl, SC_DEVOTION, -1);
+ status_change_end(bl, SC_DEVOTION, INVALID_TIMER);
}
if(skillid == RG_INTIMIDATE && damage > 0 && !(tstatus->mode&MD_BOSS)) {
@@ -2339,7 +2339,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr data)
struct status_change *sc = status_get_sc(src);
if(sc) {
if(sc->data[SC_MAGICPOWER])
- status_change_end(src,SC_MAGICPOWER,-1);
+ 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)
@@ -2469,7 +2469,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
{ //GTB makes all targetted magic display miss with a single bolt.
sc_type sct = status_skill2sc(skillid);
if(sct != SC_NONE)
- status_change_end(bl, sct, -1);
+ status_change_end(bl, sct, INVALID_TIMER);
clif_skill_damage(src, bl, tick, status_get_amotion(src), status_get_dmotion(bl), 0, 1, skillid, skilllv, skill_get_hit(skillid));
return 1;
}
@@ -2663,7 +2663,7 @@ 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,-1);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
break;
case RG_BACKSTAP:
@@ -2671,7 +2671,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
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, -1);
+ 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);
@@ -2689,24 +2689,24 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
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,-1);
+ 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,-1);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
break;
case NJ_ISSEN:
- status_change_end(src,SC_NEN,-1);
- status_change_end(src,SC_HIDING,-1);
+ status_change_end(src, SC_NEN, INVALID_TIMER);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
// fall through
case MO_EXTREMITYFIST:
if( skillid == MO_EXTREMITYFIST )
{
- status_change_end(src,SC_EXPLOSIONSPIRITS,-1);
- status_change_end(src,SC_BLADESTOP,-1);
+ status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
}
//Client expects you to move to target regardless of distance
{
@@ -2992,7 +2992,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
case SL_SMA:
if (sc && sc->data[SC_SMA])
- status_change_end(src,SC_SMA,-1);
+ 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) {
@@ -3066,7 +3066,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
clif_slide(src,src->x,src->y);
}
if (sc && sc->data[SC_HIDING])
- status_change_end(src, SC_HIDING, -1);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag);
break;
case 0:
@@ -3208,7 +3208,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if( tsc->data[SC_KAITE] && !(sstatus->mode&MD_BOSS) )
{ //Bounce back heal
if (--tsc->data[SC_KAITE]->val2 <= 0)
- status_change_end(bl, SC_KAITE, -1);
+ status_change_end(bl, SC_KAITE, INVALID_TIMER);
if (src == bl)
heal=0; //When you try to heal yourself under Kaite, the heal is voided.
else {
@@ -3327,7 +3327,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case PR_LEXDIVINA:
case MER_LEXDIVINA:
if( tsce )
- status_change_end(bl,type, -1);
+ status_change_end(bl,type, INVALID_TIMER);
else
sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv));
clif_skill_nodamage (src, bl, skillid, skilllv, 1);
@@ -3441,9 +3441,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
{
const enum sc_type scs[] = { SC_QUAGMIRE, SC_PROVOKE, SC_ROKISWEIL, SC_GRAVITATION, SC_SUITON, SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM, SC_BLADESTOP };
for (i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++)
- if (tsc->data[i]) status_change_end(bl, (sc_type)i, -1);
+ if (tsc->data[i]) status_change_end(bl, (sc_type)i, INVALID_TIMER);
for (i = 0; i < ARRAYLENGTH(scs); i++)
- if (tsc->data[scs[i]]) status_change_end(bl, scs[i], -1);
+ if (tsc->data[scs[i]]) status_change_end(bl, scs[i], INVALID_TIMER);
}
}
break;
@@ -3508,8 +3508,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if( sc->data[SC_MARIONETTE ] && sc->data[SC_MARIONETTE ]->val1 == bl->id &&
tsc->data[SC_MARIONETTE2] && tsc->data[SC_MARIONETTE2]->val1 == src->id )
{
- status_change_end(src, SC_MARIONETTE, -1);
- status_change_end(bl, SC_MARIONETTE2, -1);
+ status_change_end(src, SC_MARIONETTE, INVALID_TIMER);
+ status_change_end(bl, SC_MARIONETTE2, INVALID_TIMER);
}
else
{
@@ -3699,7 +3699,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
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,-1);
+ status_change_end(bl, SC_NEN, INVALID_TIMER);
break;
/* Was modified to only affect targetted char. [Skotlex]
case HP_ASSUMPTIO:
@@ -3805,11 +3805,11 @@ 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,-1);
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
if( tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE )
- status_change_end(bl,SC_STONE,-1);
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
if( tsc->data[SC_SLEEP] )
- status_change_end(bl,SC_SLEEP,-1);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
}
if( dstmd )
@@ -3947,7 +3947,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
skill_get_splash(skillid, skilllv), splash_target(src),
src,skillid,skilllv,tick, flag|BCT_ENEMY|1,
skill_castend_damage_id);
- status_change_end(src, SC_HIDING, -1);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
break;
case ASC_METEORASSAULT:
@@ -4016,7 +4016,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case WZ_SIGHTRASHER:
//Passive side of the attack.
- status_change_end(src,SC_SIGHT,-1);
+ status_change_end(src, SC_SIGHT, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
map_foreachinrange(skill_area_sub,src,
skill_get_splash(skillid, skilllv),BL_CHAR|BL_SKILL,
@@ -4104,7 +4104,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case GS_GATLINGFEVER:
if( tsce )
{
- clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, -1));
+ clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, INVALID_TIMER));
map_freeblock_unlock();
return 0;
}
@@ -4133,7 +4133,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case SM_AUTOBERSERK:
case MER_AUTOBERSERK:
if( tsce )
- i = status_change_end(bl, type, -1);
+ i = status_change_end(bl, type, INVALID_TIMER);
else
i = sc_start(bl,type,100,skilllv,60000);
clif_skill_nodamage(src,bl,skillid,skilllv,i);
@@ -4142,7 +4142,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case ST_CHASEWALK:
if (tsce)
{
- clif_skill_nodamage(src,bl,skillid,-1,status_change_end(bl, type, -1)); //Hide skill-scream animation.
+ clif_skill_nodamage(src,bl,skillid,-1,status_change_end(bl, type, INVALID_TIMER)); //Hide skill-scream animation.
map_freeblock_unlock();
return 0;
}
@@ -4151,7 +4151,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case TK_RUN:
if (tsce)
{
- clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, -1));
+ clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, INVALID_TIMER));
map_freeblock_unlock();
return 0;
}
@@ -4162,7 +4162,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case AS_CLOAKING:
if (tsce)
{
- i = status_change_end(bl, type, -1);
+ i = status_change_end(bl, type, INVALID_TIMER);
if( i )
clif_skill_nodamage(src,bl,skillid,-1,i);
else if( sd )
@@ -4180,7 +4180,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case BD_ADAPTATION:
if(tsc && tsc->data[SC_DANCING]){
clif_skill_nodamage(src,bl,skillid,skilllv,1);
- status_change_end(bl, SC_DANCING, -1);
+ status_change_end(bl, SC_DANCING, INVALID_TIMER);
}
break;
@@ -4253,7 +4253,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
if (tsc->data[SC_STONE]) {
- status_change_end(bl,SC_STONE,-1);
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
if (sd) clif_skill_fail(sd,skillid,0,0);
break;
}
@@ -4283,16 +4283,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
clif_skill_nodamage(src,bl,skillid,skilllv,0);
break;
}
- status_change_end(bl, SC_SILENCE , -1 );
- status_change_end(bl, SC_BLIND , -1 );
- status_change_end(bl, SC_CONFUSION, -1 );
+ status_change_end(bl, SC_SILENCE, INVALID_TIMER);
+ status_change_end(bl, SC_BLIND, INVALID_TIMER);
+ status_change_end(bl, SC_CONFUSION, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case TF_DETOXIFY:
clif_skill_nodamage(src,bl,skillid,skilllv,1);
- status_change_end(bl, SC_POISON , -1 );
- status_change_end(bl, SC_DPOISON , -1 );
+ status_change_end(bl, SC_POISON, INVALID_TIMER);
+ status_change_end(bl, SC_DPOISON, INVALID_TIMER);
break;
case PR_STRECOVERY:
@@ -4301,10 +4301,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
}
if (tsc && tsc->opt1) {
- status_change_end(bl, SC_FREEZE, -1 );
- status_change_end(bl, SC_STONE, -1 );
- status_change_end(bl, SC_SLEEP, -1 );
- status_change_end(bl, SC_STUN, -1 );
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
+ status_change_end(bl, SC_STUN, INVALID_TIMER);
}
//Is this equation really right? It looks so... special.
if(battle_check_undead(tstatus->race,tstatus->def_ele))
@@ -4321,31 +4321,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
// Mercenary Supportive Skills
case MER_BENEDICTION:
- status_change_end(bl, SC_CURSE, -1);
- status_change_end(bl, SC_BLIND, -1);
+ status_change_end(bl, SC_CURSE, INVALID_TIMER);
+ status_change_end(bl, SC_BLIND, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case MER_COMPRESS:
- status_change_end(bl, SC_BLEEDING, -1);
+ status_change_end(bl, SC_BLEEDING, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case MER_MENTALCURE:
- status_change_end(bl, SC_CONFUSION, -1);
+ status_change_end(bl, SC_CONFUSION, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case MER_RECUPERATE:
- status_change_end(bl, SC_POISON, -1);
- status_change_end(bl, SC_SILENCE, -1);
+ status_change_end(bl, SC_POISON, INVALID_TIMER);
+ status_change_end(bl, SC_SILENCE, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case MER_REGAIN:
- status_change_end(bl, SC_SLEEP, -1);
- status_change_end(bl, SC_STUN, -1);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
+ status_change_end(bl, SC_STUN, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case MER_TENDER:
- status_change_end(bl, SC_FREEZE, -1);
- status_change_end(bl, SC_STONE, -1);
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
@@ -4643,7 +4643,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
{
enum sc_type scid = (sc_type)(SC_STRIPWEAPON + (skillid - AM_CP_WEAPON));
if(tsc && tsc->data[scid])
- status_change_end(bl, scid, -1 );
+ 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)));
}
@@ -4735,7 +4735,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
}
if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
- status_change_end(bl,(sc_type)i,-1);
+ status_change_end(bl, (sc_type)i, INVALID_TIMER);
}
break;
}
@@ -4796,7 +4796,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
} else {
struct unit_data *ud = unit_bl2ud(bl);
int bl_skillid=0,bl_skilllv=0,hp = 0;
- if (!ud || ud->skilltimer == -1) break; //Nothing to cancel.
+ if (!ud || ud->skilltimer == INVALID_TIMER)
+ break; //Nothing to cancel.
bl_skillid = ud->skillid;
bl_skilllv = ud->skilllv;
if (tstatus->mode & MD_BOSS)
@@ -5021,7 +5022,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
{
clif_emotion(bl, md->db->skill[md->skillidx].val[0]);
if(md->db->skill[md->skillidx].val[4] && tsce)
- status_change_end(bl, type, -1);
+ status_change_end(bl, type, INVALID_TIMER);
if(md->db->skill[md->skillidx].val[1] || md->db->skill[md->skillidx].val[2])
sc_start4(src, type, 100, skilllv,
@@ -5226,11 +5227,11 @@ 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,-1);
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
if(tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE)
- status_change_end(bl,SC_STONE,-1);
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
if(tsc->data[SC_SLEEP])
- status_change_end(bl,SC_SLEEP,-1);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
}
if(dstmd)
@@ -5298,7 +5299,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
for (i=0; i<4; i++) {
if(tsc->data[SC_STRIPWEAPON + i])
- status_change_end(bl, (sc_type)(SC_STRIPWEAPON + i), -1 );
+ 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);
@@ -5771,7 +5772,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
return 0;
}
- if( sd && ud->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) > 0 )
+ if( sd && ud->skilltimer != INVALID_TIMER && pc_checkskill(sd,SA_FREECAST) > 0 )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
status_calc_bl(&sd->bl, SCB_SPEED);
@@ -5875,7 +5876,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
}
//Avoid doing double checks for instant-cast skills.
- if (tid != -1 && !status_check_skilluse(src, target, ud->skillid, 1))
+ if (tid != INVALID_TIMER && !status_check_skilluse(src, target, ud->skillid, 1))
break;
if(md) {
@@ -5909,7 +5910,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
if (ud->state.running && ud->skillid == TK_JUMPKICK)
flag = 1;
- if (ud->walktimer != -1 && ud->skillid != TK_RUN)
+ if (ud->walktimer != INVALID_TIMER && ud->skillid != TK_RUN)
unit_stop_walking(src,1);
if( !sd || sd->skillitem != ud->skillid || skill_get_delay(ud->skillid,ud->skilllv) )
@@ -5952,7 +5953,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
if(sc && sc->count) {
if(sc->data[SC_MAGICPOWER] &&
ud->skillid != HW_MAGICPOWER && ud->skillid != WZ_WATERBALL)
- status_change_end(src,SC_MAGICPOWER,-1);
+ 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 == ud->skillid &&
@@ -5966,7 +5967,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
if( sd && ud->skillid != SA_ABRACADABRA ) // Hocus-Pocus has just set the data so leave it as it is.[Inkfish]
sd->skillitem = sd->skillitemlv = 0;
- if (ud->skilltimer == -1) {
+ if (ud->skilltimer == INVALID_TIMER) {
if(md) md->skillidx = -1;
else ud->skillid = 0; //mobs can't clear this one as it is used for skill condition 'afterskill'
ud->skilllv = ud->skilltarget = 0;
@@ -5985,9 +5986,9 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
if (sc->count)
{ //End states
if (sc->data[SC_EXPLOSIONSPIRITS])
- status_change_end(src, SC_EXPLOSIONSPIRITS, -1);
+ status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
if (sc->data[SC_BLADESTOP])
- status_change_end(src,SC_BLADESTOP,-1);
+ status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
}
if (target && target->m == src->m)
{ //Move character to target anyway.
@@ -6049,7 +6050,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr data)
return 0;
}
- if( sd && ud->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) > 0 )
+ if( sd && ud->skilltimer != INVALID_TIMER && pc_checkskill(sd,SA_FREECAST) > 0 )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
status_calc_bl(&sd->bl, SCB_SPEED);
@@ -6091,7 +6092,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr data)
}
}
- if(tid != -1)
+ if(tid != INVALID_TIMER)
{ //Avoid double checks on instant cast skills. [Skotlex]
if (!status_check_skilluse(src, NULL, ud->skillid, 1))
break;
@@ -6124,7 +6125,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr data)
ShowInfo("Type %d, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n",
src->type, src->id, ud->skillid, ud->skilllv, ud->skillx, ud->skilly);
- if (ud->walktimer != -1)
+ if (ud->walktimer != INVALID_TIMER)
unit_stop_walking(src,1);
if( !sd || sd->skillitem != ud->skillid || skill_get_delay(ud->skillid,ud->skilllv) )
@@ -6148,7 +6149,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr data)
if( sd && sd->skillitem != AL_WARP ) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish]
sd->skillitem = sd->skillitemlv = 0;
- if (ud->skilltimer == -1) {
+ if (ud->skilltimer == INVALID_TIMER) {
if (md) md->skillidx = -1;
else ud->skillid = 0; //Non mobs can't clear this one as it is used for skill condition 'afterskill'
ud->skilllv = ud->skillx = ud->skilly = 0;
@@ -6335,7 +6336,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
break;
case HP_BASILICA:
if( sc->data[SC_BASILICA] )
- status_change_end(src, SC_BASILICA, -1); // Cancel Basilica
+ status_change_end(src, SC_BASILICA, INVALID_TIMER); // Cancel Basilica
else
{ // Create Basilica. Start SC on caster. Unit timer start SC on others.
skill_clear_unitgroup(src);
@@ -6409,7 +6410,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
clif_slide(src,x,y);
}
if (sc && sc->data[SC_HIDING])
- status_change_end(src, SC_HIDING, -1);
+ status_change_end(src, SC_HIDING, INVALID_TIMER);
break;
case AM_SPHEREMINE:
case AM_CANNIBALIZE:
@@ -6544,7 +6545,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
case PA_GOSPEL:
if (sce && sce->val4 == BCT_SELF)
{
- status_change_end(src,SC_GOSPEL,-1);
+ status_change_end(src, SC_GOSPEL, INVALID_TIMER);
return 0;
}
else
@@ -6552,7 +6553,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0);
if (!sg) break;
if (sce)
- status_change_end(src,type,-1); //Was under someone else's Gospel. [Skotlex]
+ status_change_end(src, type, INVALID_TIMER); //Was under someone else's Gospel. [Skotlex]
sc_start4(src,type,100,skilllv,0,sg->group_id,BCT_SELF,skill_get_time(skillid,skilllv));
clif_skill_poseffect(src, skillid, skilllv, 0, 0, tick); // PA_GOSPEL music packet
}
@@ -6579,7 +6580,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
}
if (sc && sc->data[SC_MAGICPOWER])
- status_change_end(src,SC_MAGICPOWER,-1);
+ status_change_end(src, SC_MAGICPOWER, INVALID_TIMER);
if( sd )
{
@@ -7807,17 +7808,17 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
case UNT_SAFETYWALL:
case UNT_PNEUMA:
if (sce)
- status_change_end(bl,type,-1);
+ status_change_end(bl, type, INVALID_TIMER);
break;
case UNT_BASILICA:
if( sce && sce->val4 == src->bl.id )
- status_change_end(bl,type,-1);
+ status_change_end(bl, type, INVALID_TIMER);
break;
case UNT_HERMODE: //Clear Hermode if the owner moved.
if (sce && sce->val3 == BCT_SELF && sce->val4 == sg->group_id)
- status_change_end(bl,type,-1);
+ status_change_end(bl, type, INVALID_TIMER);
break;
case UNT_SPIDERWEB:
@@ -7826,7 +7827,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
if (target && target==bl)
{
if (sce && sce->val3 == sg->group_id)
- status_change_end(bl,type,-1);
+ status_change_end(bl, type, INVALID_TIMER);
sg->limit = DIFF_TICK(tick,sg->tick)+1000;
}
break;
@@ -7857,7 +7858,7 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
if (bl->type==BL_MOB)
break;
if (sce)
- status_change_end(bl, type, -1);
+ status_change_end(bl, type, INVALID_TIMER);
break;
case BD_LULLABY:
@@ -7875,7 +7876,7 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
//it only checks if you are doing the same ensemble. So if there's two chars doing an ensemble
//which overlaps, by stepping outside of the other parther's ensemble will cause you to cancel
//your own. Let's pray that scenario is pretty unlikely and noone will complain too much about it.
- status_change_end(bl, SC_DANCING, -1);
+ status_change_end(bl, SC_DANCING, INVALID_TIMER);
}
case MG_SAFETYWALL:
case AL_PNEUMA:
@@ -7886,7 +7887,7 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
case HW_GRAVITATION:
case NJ_SUITON:
if (sce)
- status_change_end(bl, type, -1);
+ status_change_end(bl, type, INVALID_TIMER);
break;
case BA_POEMBRAGI:
@@ -7909,11 +7910,11 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
case PF_FOGWALL:
if (sce)
{
- status_change_end(bl,type,-1);
+ status_change_end(bl, type, INVALID_TIMER);
if ((sce=sc->data[SC_BLIND]))
{
if (bl->type == BL_PC) //Players get blind ended inmediately, others have it still for 30 secs. [Skotlex]
- status_change_end(bl, SC_BLIND, -1);
+ status_change_end(bl, SC_BLIND, INVALID_TIMER);
else {
delete_timer(sce->timer, status_change_timer);
sce->timer = add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND);
@@ -8252,7 +8253,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
switch( skill )
{
case SA_CASTCANCEL:
- if(sd->ud.skilltimer == -1) {
+ if(sd->ud.skilltimer == INVALID_TIMER) {
clif_skill_fail(sd,skill,0,0);
return 0;
}
@@ -8352,7 +8353,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
if (pc_famerank(sd->status.char_id,MAPID_TAEKWON))
{ //Unlimited Combo
if (skill == sd->skillid_old) {
- status_change_end(&sd->bl, SC_COMBO, -1);
+ status_change_end(&sd->bl, SC_COMBO, INVALID_TIMER);
sd->skillid_old = sd->skilllv_old = 0;
return 0; //Can't repeat previous combo skill.
}
@@ -9046,12 +9047,12 @@ int skill_castfix_sc (struct block_list *bl, int time)
time += time * sc->data[SC_SLOWCAST]->val2 / 100;
if (sc->data[SC_SUFFRAGIUM]) {
time -= time * sc->data[SC_SUFFRAGIUM]->val2 / 100;
- status_change_end(bl, SC_SUFFRAGIUM, -1);
+ status_change_end(bl, SC_SUFFRAGIUM, INVALID_TIMER);
}
if (sc->data[SC_MEMORIZE]) {
time>>=1;
if ((--sc->data[SC_MEMORIZE]->val2) <= 0)
- status_change_end(bl, SC_MEMORIZE, -1);
+ status_change_end(bl, SC_MEMORIZE, INVALID_TIMER);
}
if (sc->data[SC_POEMBRAGI])
time -= time * sc->data[SC_POEMBRAGI]->val2 / 100;
@@ -9915,7 +9916,7 @@ int skill_enchant_elemental_end (struct block_list *bl, int type)
for (i = 0; i < ARRAYLENGTH(scs); i++)
if (type != scs[i] && sc->data[scs[i]])
- status_change_end(bl, scs[i], -1);
+ status_change_end(bl, scs[i], INVALID_TIMER);
return 0;
}
@@ -9940,7 +9941,7 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
if( !wall )
{
if( sce->val1 < 3 ) //End cloaking.
- status_change_end(bl, SC_CLOAKING, -1);
+ status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
else
if( sce->val4&1 )
{ //Remove wall bonus
@@ -10039,7 +10040,7 @@ int skill_delunit (struct skill_unit* unit)
{
struct block_list* target = map_id2bl(group->val2);
if( target )
- status_change_end(target,SC_ANKLE,-1);
+ status_change_end(target, SC_ANKLE, INVALID_TIMER);
}
break;
case WZ_ICEWALL:
@@ -10185,7 +10186,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
if (sc && sc->data[SC_DANCING])
{
sc->data[SC_DANCING]->val2 = 0 ; //This prevents status_change_end attempting to redelete the group. [Skotlex]
- status_change_end(src,SC_DANCING,-1);
+ status_change_end(src, SC_DANCING, INVALID_TIMER);
}
}
@@ -10195,7 +10196,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
struct status_change *sc = status_get_sc(src);
if(sc && sc->data[SC_GOSPEL]) {
sc->data[SC_GOSPEL]->val3 = 0; //Remove reference to this group. [Skotlex]
- status_change_end(src,SC_GOSPEL,-1);
+ status_change_end(src, SC_GOSPEL, INVALID_TIMER);
}
}
@@ -10205,7 +10206,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
struct status_change *sc = status_get_sc(src);
if(sc && sc->data[SC_WARM]) {
sc->data[SC_WARM]->val4 = 0;
- status_change_end(src,SC_WARM,-1);
+ status_change_end(src, SC_WARM, INVALID_TIMER);
}
}
diff --git a/src/map/status.c b/src/map/status.c
index 449ea8f56..21bc9bf92 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -698,20 +698,20 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
if( sc ) {
struct status_change_entry *sce;
if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE)
- status_change_end(target,SC_STONE,-1);
- status_change_end(target,SC_FREEZE,-1);
- status_change_end(target,SC_SLEEP,-1);
- status_change_end(target,SC_WINKCHARM,-1);
- status_change_end(target,SC_CONFUSION,-1);
- status_change_end(target,SC_TRICKDEAD,-1);
- status_change_end(target,SC_HIDING,-1);
- status_change_end(target,SC_CLOAKING,-1);
- status_change_end(target,SC_CHASEWALK,-1);
+ status_change_end(target, SC_STONE, INVALID_TIMER);
+ status_change_end(target, SC_FREEZE, INVALID_TIMER);
+ status_change_end(target, SC_SLEEP, INVALID_TIMER);
+ status_change_end(target, SC_WINKCHARM, INVALID_TIMER);
+ status_change_end(target, SC_CONFUSION, INVALID_TIMER);
+ status_change_end(target, SC_TRICKDEAD, INVALID_TIMER);
+ status_change_end(target, SC_HIDING, INVALID_TIMER);
+ status_change_end(target, SC_CLOAKING, INVALID_TIMER);
+ status_change_end(target, SC_CHASEWALK, INVALID_TIMER);
if ((sce=sc->data[SC_ENDURE]) && !sce->val4) {
//Endure count is only reduced by non-players on non-gvg maps.
//val4 signals infinite endure. [Skotlex]
if (src && src->type != BL_PC && !map_flag_gvg(target->m) && !map[target->m].flag.battleground && --(sce->val2) < 0)
- status_change_end(target, SC_ENDURE, -1);
+ status_change_end(target, SC_ENDURE, INVALID_TIMER);
}
if ((sce=sc->data[SC_GRAVITATION]) && sce->val3 == BCT_SELF)
{
@@ -719,11 +719,11 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
if (sg) {
skill_delunitgroup(sg);
sce->val4 = 0;
- status_change_end(target, SC_GRAVITATION, -1);
+ status_change_end(target, SC_GRAVITATION, INVALID_TIMER);
}
}
if(sc->data[SC_DANCING] && (unsigned int)hp > status->max_hp>>2)
- status_change_end(target, SC_DANCING, -1);
+ status_change_end(target, SC_DANCING, INVALID_TIMER);
}
unit_skillcastcancel(target, 2);
}
@@ -747,7 +747,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
status->hp < status->max_hp>>2)
sc_start4(target,SC_PROVOKE,100,10,1,0,0,0);
if (sc->data[SC_BERSERK] && status->hp <= 100)
- status_change_end(target, SC_BERSERK, -1);
+ status_change_end(target, SC_BERSERK, INVALID_TIMER);
}
switch (target->type)
@@ -899,7 +899,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
sc->data[SC_PROVOKE]->val2==1 &&
status->hp>=status->max_hp>>2
) //End auto berserk.
- status_change_end(bl,SC_PROVOKE,-1);
+ status_change_end(bl, SC_PROVOKE, INVALID_TIMER);
// send hp update to client
switch(bl->type) {
@@ -2869,9 +2869,9 @@ void status_calc_bl_main(struct block_list *bl, enum scb_flag flag)
struct unit_data *ud = unit_bl2ud(bl);
status->speed = status_calc_speed(bl, sc, b_status->speed);
- //Re-walk to adjust speed (we do not check if walktimer != -1
+ //Re-walk to adjust speed (we do not check if walktimer != INVALID_TIMER
//because if you step on something while walking, the moment this
- //piece of code triggers the walk-timer is set on -1) [Skotlex]
+ //piece of code triggers the walk-timer is set on INVALID_TIMER) [Skotlex]
if (ud)
ud->state.change_walk_target = ud->state.speed_changed = 1;
@@ -3757,7 +3757,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
if( sc == NULL )
return cap_value(speed,10,USHRT_MAX);
- if( sd && sd->ud.skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) > 0 )
+ if( sd && sd->ud.skilltimer != INVALID_TIMER && pc_checkskill(sd,SA_FREECAST) > 0 )
{
speed_rate = 175 - 5 * pc_checkskill(sd,SA_FREECAST);
}
@@ -4213,7 +4213,7 @@ signed char status_get_def(struct block_list *bl)
struct status_data *status = status_get_status_data(bl);
int def = status?status->def:0;
ud = unit_bl2ud(bl);
- if (ud && ud->skilltimer != -1)
+ if (ud && ud->skilltimer != INVALID_TIMER)
def -= def * skill_get_castdef(ud->skillid)/100;
return cap_value(def, CHAR_MIN, CHAR_MAX);
}
@@ -4846,7 +4846,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if (val3) mode|= val3; //Add mode
if (mode == bstatus->mode) { //No change.
if (sc->data[type]) //Abort previous status
- return status_change_end(bl, type, -1);
+ return status_change_end(bl, type, INVALID_TIMER);
return 0;
}
}
@@ -5002,132 +5002,132 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//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,-1);
+ status_change_end(bl, SC_CURSE, INVALID_TIMER);
if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE)
- status_change_end(bl,SC_STONE,-1);
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
}
break;
case SC_INCREASEAGI:
- status_change_end(bl,SC_DECREASEAGI,-1);
+ status_change_end(bl, SC_DECREASEAGI, INVALID_TIMER);
break;
case SC_QUAGMIRE:
- status_change_end(bl,SC_CONCENTRATE,-1);
- status_change_end(bl,SC_TRUESIGHT,-1);
- status_change_end(bl,SC_WINDWALK,-1);
+ status_change_end(bl, SC_CONCENTRATE, INVALID_TIMER);
+ status_change_end(bl, SC_TRUESIGHT, INVALID_TIMER);
+ status_change_end(bl, SC_WINDWALK, INVALID_TIMER);
//Also blocks the ones below...
case SC_DECREASEAGI:
- status_change_end(bl,SC_CARTBOOST,-1);
+ status_change_end(bl, SC_CARTBOOST, INVALID_TIMER);
//Also blocks the ones below...
case SC_DONTFORGETME:
- status_change_end(bl,SC_INCREASEAGI,-1);
- status_change_end(bl,SC_ADRENALINE,-1);
- status_change_end(bl,SC_ADRENALINE2,-1);
- status_change_end(bl,SC_SPEARQUICKEN,-1);
- status_change_end(bl,SC_TWOHANDQUICKEN,-1);
- status_change_end(bl,SC_ONEHAND,-1);
- status_change_end(bl,SC_MERC_QUICKEN,-1);
+ status_change_end(bl, SC_INCREASEAGI, INVALID_TIMER);
+ status_change_end(bl, SC_ADRENALINE, INVALID_TIMER);
+ status_change_end(bl, SC_ADRENALINE2, INVALID_TIMER);
+ status_change_end(bl, SC_SPEARQUICKEN, INVALID_TIMER);
+ status_change_end(bl, SC_TWOHANDQUICKEN, INVALID_TIMER);
+ status_change_end(bl, SC_ONEHAND, INVALID_TIMER);
+ status_change_end(bl, SC_MERC_QUICKEN, INVALID_TIMER);
break;
case SC_ONEHAND:
//Removes the Aspd potion effect, as reported by Vicious. [Skotlex]
- status_change_end(bl,SC_ASPDPOTION0,-1);
- status_change_end(bl,SC_ASPDPOTION1,-1);
- status_change_end(bl,SC_ASPDPOTION2,-1);
- status_change_end(bl,SC_ASPDPOTION3,-1);
+ status_change_end(bl, SC_ASPDPOTION0, INVALID_TIMER);
+ status_change_end(bl, SC_ASPDPOTION1, INVALID_TIMER);
+ status_change_end(bl, SC_ASPDPOTION2, INVALID_TIMER);
+ status_change_end(bl, SC_ASPDPOTION3, INVALID_TIMER);
break;
case SC_MAXOVERTHRUST:
//Cancels Normal Overthrust. [Skotlex]
- status_change_end(bl, SC_OVERTHRUST, -1);
+ status_change_end(bl, SC_OVERTHRUST, INVALID_TIMER);
break;
case SC_KYRIE:
//Cancels Assumptio
- status_change_end(bl,SC_ASSUMPTIO,-1);
+ status_change_end(bl, SC_ASSUMPTIO, INVALID_TIMER);
break;
case SC_DELUGE:
if (sc->data[SC_FOGWALL] && sc->data[SC_BLIND])
- status_change_end(bl,SC_BLIND,-1);
+ status_change_end(bl, SC_BLIND, INVALID_TIMER);
break;
case SC_SILENCE:
if (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF)
- status_change_end(bl,SC_GOSPEL,-1);
+ status_change_end(bl, SC_GOSPEL, INVALID_TIMER);
break;
case SC_HIDING:
- status_change_end(bl, SC_CLOSECONFINE, -1);
- status_change_end(bl, SC_CLOSECONFINE2, -1);
+ status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
+ status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
break;
case SC_BERSERK:
if(battle_config.berserk_cancels_buffs)
{
- status_change_end(bl,SC_ONEHAND,-1);
- status_change_end(bl,SC_TWOHANDQUICKEN,-1);
- status_change_end(bl,SC_CONCENTRATION,-1);
- status_change_end(bl,SC_PARRYING,-1);
- status_change_end(bl,SC_AURABLADE,-1);
- status_change_end(bl,SC_MERC_QUICKEN,-1);
+ status_change_end(bl, SC_ONEHAND, INVALID_TIMER);
+ status_change_end(bl, SC_TWOHANDQUICKEN, INVALID_TIMER);
+ status_change_end(bl, SC_CONCENTRATION, INVALID_TIMER);
+ status_change_end(bl, SC_PARRYING, INVALID_TIMER);
+ status_change_end(bl, SC_AURABLADE, INVALID_TIMER);
+ status_change_end(bl, SC_MERC_QUICKEN, INVALID_TIMER);
}
break;
case SC_ASSUMPTIO:
- status_change_end(bl,SC_KYRIE,-1);
- status_change_end(bl,SC_KAITE,-1);
+ status_change_end(bl, SC_KYRIE, INVALID_TIMER);
+ status_change_end(bl, SC_KAITE, INVALID_TIMER);
break;
case SC_KAITE:
- status_change_end(bl,SC_ASSUMPTIO,-1);
+ status_change_end(bl, SC_ASSUMPTIO, INVALID_TIMER);
break;
case SC_CARTBOOST:
if(sc->data[SC_DECREASEAGI])
{ //Cancel Decrease Agi, but take no further effect [Skotlex]
- status_change_end(bl,SC_DECREASEAGI,-1);
+ status_change_end(bl, SC_DECREASEAGI, INVALID_TIMER);
return 0;
}
break;
case SC_FUSION:
- status_change_end(bl,SC_SPIRIT,-1);
+ status_change_end(bl, SC_SPIRIT, INVALID_TIMER);
break;
case SC_ADJUSTMENT:
- status_change_end(bl,SC_MADNESSCANCEL,-1);
+ status_change_end(bl, SC_MADNESSCANCEL, INVALID_TIMER);
break;
case SC_MADNESSCANCEL:
- status_change_end(bl,SC_ADJUSTMENT,-1);
+ status_change_end(bl, SC_ADJUSTMENT, INVALID_TIMER);
break;
//NPC_CHANGEUNDEAD will debuff Blessing and Agi Up
case SC_CHANGEUNDEAD:
- status_change_end(bl,SC_BLESSING,-1);
- status_change_end(bl,SC_INCREASEAGI,-1);
+ status_change_end(bl, SC_BLESSING, INVALID_TIMER);
+ status_change_end(bl, SC_INCREASEAGI, INVALID_TIMER);
break;
case SC_STRFOOD:
- status_change_end(bl,SC_FOOD_STR_CASH,-1);
+ status_change_end(bl, SC_FOOD_STR_CASH, INVALID_TIMER);
break;
case SC_AGIFOOD:
- status_change_end(bl,SC_FOOD_AGI_CASH,-1);
+ status_change_end(bl, SC_FOOD_AGI_CASH, INVALID_TIMER);
break;
case SC_VITFOOD:
- status_change_end(bl,SC_FOOD_VIT_CASH,-1);
+ status_change_end(bl, SC_FOOD_VIT_CASH, INVALID_TIMER);
break;
case SC_INTFOOD:
- status_change_end(bl,SC_FOOD_INT_CASH,-1);
+ status_change_end(bl, SC_FOOD_INT_CASH, INVALID_TIMER);
break;
case SC_DEXFOOD:
- status_change_end(bl,SC_FOOD_DEX_CASH,-1);
+ status_change_end(bl, SC_FOOD_DEX_CASH, INVALID_TIMER);
break;
case SC_LUKFOOD:
- status_change_end(bl,SC_FOOD_LUK_CASH,-1);
+ status_change_end(bl, SC_FOOD_LUK_CASH, INVALID_TIMER);
break;
case SC_FOOD_STR_CASH:
- status_change_end(bl,SC_STRFOOD,-1);
+ status_change_end(bl, SC_STRFOOD, INVALID_TIMER);
break;
case SC_FOOD_AGI_CASH:
- status_change_end(bl,SC_AGIFOOD,-1);
+ status_change_end(bl, SC_AGIFOOD, INVALID_TIMER);
break;
case SC_FOOD_VIT_CASH:
- status_change_end(bl,SC_VITFOOD,-1);
+ status_change_end(bl, SC_VITFOOD, INVALID_TIMER);
break;
case SC_FOOD_INT_CASH:
- status_change_end(bl,SC_INTFOOD,-1);
+ status_change_end(bl, SC_INTFOOD, INVALID_TIMER);
break;
case SC_FOOD_DEX_CASH:
- status_change_end(bl,SC_DEXFOOD,-1);
+ status_change_end(bl, SC_DEXFOOD, INVALID_TIMER);
break;
case SC_FOOD_LUK_CASH:
- status_change_end(bl,SC_LUKFOOD,-1);
+ status_change_end(bl, SC_LUKFOOD, INVALID_TIMER);
break;
}
@@ -5198,9 +5198,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_KAAHI:
//Kaahi overwrites previous level regardless of existing level.
//Delete timer if it exists.
- if (sce->val4 != -1) {
+ if (sce->val4 != INVALID_TIMER) {
delete_timer(sce->val4,kaahi_heal_timer);
- sce->val4=-1;
+ sce->val4 = INVALID_TIMER;
}
break;
case SC_JAILED:
@@ -5821,7 +5821,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_KAAHI:
val2 = 200*val1; //HP heal
val3 = 5*val1; //SP cost
- val4 = -1; //Kaahi Timer.
+ val4 = INVALID_TIMER; //Kaahi Timer.
break;
case SC_BLESSING:
if ((!undead_flag && status->race!=RC_DEMON) || bl->type == BL_PC)
@@ -6087,7 +6087,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
clif_changelook(bl,LOOK_CLOTHES_COLOR,val4);
break;
case SC_KAAHI:
- val4 = -1;
+ val4 = INVALID_TIMER;
break;
}
@@ -6102,7 +6102,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
pc_setstand(sd);
case SC_TRICKDEAD:
unit_stop_attack(bl);
- status_change_end(bl, SC_DANCING, -1);
+ status_change_end(bl, SC_DANCING, INVALID_TIMER);
// Cancel cast when get status [LuzZza]
if (battle_config.sc_castcancel&bl->type)
unit_skillcastcancel(bl, 0);
@@ -6448,14 +6448,14 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
sd = BL_CAST(BL_PC,bl);
- if (sce->timer != tid && tid != -1)
+ if (sce->timer != tid && tid != INVALID_TIMER)
return 0;
- if (tid == -1) {
+ if (tid == INVALID_TIMER) {
if (type == SC_ENDURE && sce->val4)
//Do not end infinite endure.
return 0;
- if (sce->timer != -1) //Could be a SC with infinite duration
+ if (sce->timer != INVALID_TIMER) //Could be a SC with infinite duration
delete_timer(sce->timer,status_change_timer);
if (sc->opt1)
switch (type) {
@@ -6514,7 +6514,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if(!ud->state.running)
begin_spurt = false;
ud->state.running = 0;
- if (ud->walktimer != -1)
+ if (ud->walktimer != INVALID_TIMER)
unit_stop_walking(bl,1);
}
if (begin_spurt && sce->val1 >= 7 &&
@@ -6526,7 +6526,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
break;
case SC_AUTOBERSERK:
if (sc->data[SC_PROVOKE] && sc->data[SC_PROVOKE]->val2 == 1)
- status_change_end(bl,SC_PROVOKE,-1);
+ status_change_end(bl, SC_PROVOKE, INVALID_TIMER);
break;
case SC_ENDURE:
@@ -6541,14 +6541,14 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
for( i = 0; i < 5; i++ )
{
if( sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) && tsd->sc.data[type] )
- status_change_end(&tsd->bl, type, -1);
+ status_change_end(&tsd->bl, type, INVALID_TIMER);
}
}
else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag )
{ // Clear Status from Master
tsd = ((TBL_MER*)bl)->master;
if( tsd && tsd->sc.data[type] )
- status_change_end(&tsd->bl, type, -1);
+ status_change_end(&tsd->bl, type, INVALID_TIMER);
}
}
break;
@@ -6564,10 +6564,10 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
clif_devotion(d_bl, NULL);
}
- status_change_end(bl,SC_AUTOGUARD,-1);
- status_change_end(bl,SC_DEFENDER,-1);
- status_change_end(bl,SC_REFLECTSHIELD,-1);
- status_change_end(bl,SC_ENDURE,-1);
+ status_change_end(bl, SC_AUTOGUARD, INVALID_TIMER);
+ status_change_end(bl, SC_DEFENDER, INVALID_TIMER);
+ status_change_end(bl, SC_REFLECTSHIELD, INVALID_TIMER);
+ status_change_end(bl, SC_ENDURE, INVALID_TIMER);
}
break;
@@ -6581,7 +6581,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if(tbl && tsc && tsc->data[SC_BLADESTOP])
{
tsc->data[SC_BLADESTOP]->val4 = 0;
- status_change_end(tbl,SC_BLADESTOP,-1);
+ status_change_end(tbl, SC_BLADESTOP, INVALID_TIMER);
}
clif_bladestop(bl, tid, 0);
}
@@ -6598,7 +6598,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if(dsc)
{ //This will prevent recursive loops.
dsc->val2 = dsc->val4 = 0;
- status_change_end(&dsd->bl, SC_DANCING, -1);
+ status_change_end(&dsd->bl, SC_DANCING, INVALID_TIMER);
}
}
@@ -6621,11 +6621,11 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if((sce->val1&0xFFFF) == CG_MOONLIT)
clif_status_change(bl,SI_MOONLIT,0,0);
- status_change_end(bl,SC_LONGING,-1);
+ status_change_end(bl, SC_LONGING, INVALID_TIMER);
}
break;
case SC_NOCHAT:
- if (sd && sd->status.manner < 0 && tid != -1)
+ if (sd && sd->status.manner < 0 && tid != INVALID_TIMER)
sd->status.manner = 0;
if (sd)
{
@@ -6636,7 +6636,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
case SC_SPLASHER:
{
struct block_list *src=map_id2bl(sce->val3);
- if(src && tid!=-1)
+ if(src && tid != INVALID_TIMER)
skill_castend_damage_id(src, bl, sce->val2, sce->val1, gettick(), SD_LEVEL );
}
break;
@@ -6648,7 +6648,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
//If status was already ended, do nothing.
//Decrease count
if (--(sc2->data[SC_CLOSECONFINE]->val1) <= 0) //No more holds, free him up.
- status_change_end(src, SC_CLOSECONFINE, -1);
+ status_change_end(src, SC_CLOSECONFINE, INVALID_TIMER);
}
}
case SC_CLOSECONFINE:
@@ -6685,7 +6685,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if (sc2 && sc2->data[type2])
{
sc2->data[type2]->val1 = 0;
- status_change_end(pbl, type2, -1);
+ status_change_end(pbl, type2, INVALID_TIMER);
}
}
break;
@@ -6697,7 +6697,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if(sc->data[SC_ENDURE] && sc->data[SC_ENDURE]->val4 == 2)
{
sc->data[SC_ENDURE]->val4 = 0;
- status_change_end(bl, SC_ENDURE, -1);
+ status_change_end(bl, SC_ENDURE, INVALID_TIMER);
}
sc_start4(bl, SC_REGENERATION, 100, 10,0,0,(RGN_HP|RGN_SP), skill_get_time(LK_BERSERK, sce->val1));
break;
@@ -6727,25 +6727,25 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
break;
case SC_KAAHI:
//Delete timer if it exists.
- if (sce->val4 != -1)
+ if (sce->val4 != INVALID_TIMER)
delete_timer(sce->val4,kaahi_heal_timer);
break;
case SC_JAILED:
- if(tid == -1)
+ if(tid == INVALID_TIMER)
break;
//natural expiration.
if(sd && sd->mapindex == sce->val2)
pc_setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, CLR_TELEPORT);
break; //guess hes not in jail :P
case SC_CHANGE:
- if (tid == -1)
+ if (tid == INVALID_TIMER)
break;
// "lose almost all their HP and SP" on natural expiration.
status_set_hp(bl, 10, 0);
status_set_sp(bl, 10, 0);
break;
case SC_AUTOTRADE:
- if (tid == -1)
+ if (tid == INVALID_TIMER)
break;
vending_closevending(sd);
map_quit(sd);
@@ -6759,7 +6759,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
struct block_list* tbl = map_id2bl(sce->val2);
sce->val2 = 0;
if( tbl && (sc = status_get_sc(tbl)) && sc->data[SC_STOP] && sc->data[SC_STOP]->val2 == bl->id )
- status_change_end(tbl, SC_STOP, -1);
+ status_change_end(tbl, SC_STOP, INVALID_TIMER);
}
break;
}
@@ -6956,13 +6956,13 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr data)
if(sce->val4 != tid) {
ShowError("kaahi_heal_timer: Timer mismatch: %d != %d\n", tid, sce->val4);
- sce->val4=-1;
+ sce->val4 = INVALID_TIMER;
return 0;
}
status=status_get_status_data(bl);
if(!status_charge(bl, 0, sce->val3)) {
- sce->val4=-1;
+ sce->val4 = INVALID_TIMER;
return 0;
}
@@ -6971,7 +6971,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr data)
hp = sce->val2;
if (hp)
status_heal(bl, hp, 0, 2);
- sce->val4=-1;
+ sce->val4 = INVALID_TIMER;
return 1;
}
@@ -7350,13 +7350,13 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
{
case SC_SIGHT: /* サイト */
case SC_CONCENTRATE:
- status_change_end(bl, SC_HIDING, -1);
- status_change_end(bl, SC_CLOAKING, -1);
+ status_change_end(bl, SC_HIDING, INVALID_TIMER);
+ status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
break;
case SC_RUWACH: /* ルアフ */
if (tsc && (tsc->data[SC_HIDING] || tsc->data[SC_CLOAKING])) {
- status_change_end(bl, SC_HIDING, -1);
- status_change_end(bl, SC_CLOAKING, -1);
+ status_change_end(bl, SC_HIDING, INVALID_TIMER);
+ status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
if(battle_check_target( src, bl, BCT_ENEMY ) > 0)
skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,1,tick,0);
}
@@ -7373,7 +7373,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
//Lock char has released the hold on everyone...
if (tsc && tsc->data[SC_CLOSECONFINE2] && tsc->data[SC_CLOSECONFINE2]->val2 == src->id) {
tsc->data[SC_CLOSECONFINE2]->val2 = 0;
- status_change_end(bl, SC_CLOSECONFINE2, -1);
+ status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
}
break;
}
@@ -7396,7 +7396,7 @@ int status_change_clear_buffs (struct block_list* bl, int type)
for( i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++ )
{
if(sc->data[i])
- status_change_end(bl,(sc_type)i,-1);
+ status_change_end(bl, (sc_type)i, INVALID_TIMER);
}
for( i = SC_COMMON_MAX+1; i < SC_MAX; i++ )
@@ -7469,7 +7469,7 @@ int status_change_clear_buffs (struct block_list* bl, int type)
continue;
break;
}
- status_change_end(bl,(sc_type)i,-1);
+ status_change_end(bl, (sc_type)i, INVALID_TIMER);
}
return 0;
}
@@ -7557,7 +7557,7 @@ static int status_natural_heal(struct block_list* bl, va_list args)
ud = unit_bl2ud(bl);
- if (flag&(RGN_HP|RGN_SHP|RGN_SSP) && ud && ud->walktimer != -1)
+ if (flag&(RGN_HP|RGN_SHP|RGN_SSP) && ud && ud->walktimer != INVALID_TIMER)
{
flag&=~(RGN_SHP|RGN_SSP);
if(!regen->state.walk)
@@ -7580,7 +7580,7 @@ static int status_natural_heal(struct block_list* bl, va_list args)
if (flag&RGN_HP)
{
rate = natural_heal_diff_tick*(regen->rate.hp+bonus);
- if (ud && ud->walktimer != -1)
+ if (ud && ud->walktimer != INVALID_TIMER)
rate/=2;
// Homun HP regen fix (they should regen as if they were sitting (twice as fast)
if(bl->type==BL_HOM) rate *=2;
diff --git a/src/map/unit.c b/src/map/unit.c
index 3b3dd0e5f..7abfde12b 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -157,7 +157,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr data)
map_moveblock(bl, x, y, tick);
ud->walk_count++; //walked cell counter, to be used for walk-triggered skills. [Skotlex]
- if (bl->x != x || bl->y != y || ud->walktimer != -1)
+ if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER)
return 0; //map_moveblock has altered the object beyond what we expected (moved/warped it)
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
@@ -197,11 +197,11 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr data)
if (md->min_chase > md->db->range3) md->min_chase--;
//Walk skills are triggered regardless of target due to the idle-walk mob state.
//But avoid triggering on stop-walk calls.
- if(tid != -1 &&
+ if(tid != INVALID_TIMER &&
!(ud->walk_count%WALK_SKILL_INTERVAL) &&
mobskill_use(md, tick, -1))
{
- if (!(ud->skillid == NPC_SELFDESTRUCTION && ud->skilltimer != -1))
+ if (!(ud->skillid == NPC_SELFDESTRUCTION && ud->skilltimer != INVALID_TIMER))
{ //Skill used, abort walking
clif_fixpos(bl); //Fix position as walk has been cancelled.
return 0;
@@ -211,7 +211,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr data)
}
}
- if(tid == -1) //A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant.
+ if(tid == INVALID_TIMER) //A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant.
return 0;
if(ud->state.change_walk_target)
@@ -306,14 +306,14 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
map_random_dir(bl, &ud->to_x, &ud->to_y);
- if(ud->walktimer != -1) {
+ if(ud->walktimer != INVALID_TIMER) {
// 現在歩いている最中の目的地変更なのでマス目の中心に来た時に
// timer関数からunit_walktoxy_subを呼ぶようにする
ud->state.change_walk_target = 1;
return 1;
}
- if(ud->attacktimer != -1) {
+ if(ud->attacktimer != INVALID_TIMER) {
delete_timer( ud->attacktimer, unit_attack_timer );
ud->attacktimer = INVALID_TIMER;
}
@@ -331,7 +331,7 @@ static int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr data)
struct block_list *bl = map_id2bl(id);
struct unit_data *ud = bl?unit_bl2ud(bl):NULL;
- if (ud && ud->walktimer == -1 && ud->target == data)
+ if (ud && ud->walktimer == INVALID_TIMER && ud->target == data)
{
if (DIFF_TICK(ud->canmove_tick, tick) > 0) //Keep waiting?
add_timer(ud->canmove_tick+1, unit_walktobl_sub, id, data);
@@ -374,7 +374,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
map_random_dir(bl, &ud->to_x, &ud->to_y);
- if(ud->walktimer != -1) {
+ if(ud->walktimer != INVALID_TIMER) {
ud->state.change_walk_target = 1;
set_mobstate(bl, flag&2);
return 1;
@@ -389,7 +389,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
if(!unit_can_move(bl))
return 0;
- if(ud->attacktimer != -1) {
+ if(ud->attacktimer != INVALID_TIMER) {
delete_timer( ud->attacktimer, unit_attack_timer );
ud->attacktimer = INVALID_TIMER;
}
@@ -413,7 +413,7 @@ int unit_run(struct block_list *bl)
return 0;
if (!unit_can_move(bl)) {
- status_change_end(bl,SC_RUN,-1);
+ status_change_end(bl, SC_RUN, INVALID_TIMER);
return 0;
}
@@ -443,7 +443,7 @@ int unit_run(struct block_list *bl)
//Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin]
unit_bl2ud(bl)->state.running = 0;
- status_change_end(bl,SC_RUN,-1);
+ status_change_end(bl, SC_RUN, INVALID_TIMER);
skill_blown(bl,bl,skill_get_blewcount(TK_RUN,lv),unit_getdir(bl),0);
clif_fixpos(bl); //Why is a clif_slide (skill_blown) AND a fixpos needed? Ask Aegis.
@@ -463,7 +463,7 @@ int unit_run(struct block_list *bl)
//Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin]
unit_bl2ud(bl)->state.running = 0;
- status_change_end(bl,SC_RUN,-1);
+ status_change_end(bl, SC_RUN, INVALID_TIMER);
skill_blown(bl,bl,skill_get_blewcount(TK_RUN,lv),unit_getdir(bl),0);
clif_fixpos(bl);
@@ -725,7 +725,7 @@ int unit_stop_walking(struct block_list *bl,int type)
nullpo_ret(bl);
ud = unit_bl2ud(bl);
- if(!ud || ud->walktimer == -1)
+ if(!ud || ud->walktimer == INVALID_TIMER)
return 0;
//NOTE: We are using timer data after deleting it because we know the
//delete_timer function does not messes with it. If the function's
@@ -739,7 +739,7 @@ int unit_stop_walking(struct block_list *bl,int type)
|| (type&0x04 && td && DIFF_TICK(td->tick, tick) <= td->data/2) //Enough time has passed to cover half-cell
) {
ud->walkpath.path_len = ud->walkpath.path_pos+1;
- unit_walktoxy_timer(-1, tick, bl->id, ud->walkpath.path_pos);
+ unit_walktoxy_timer(INVALID_TIMER, tick, bl->id, ud->walkpath.path_pos);
}
if(type&0x01)
@@ -754,7 +754,7 @@ int unit_stop_walking(struct block_list *bl,int type)
//Readded, the check in unit_set_walkdelay means dmg during running won't fall through to this place in code [Kevin]
if (ud->state.running)
- status_change_end(bl, SC_RUN, -1);
+ status_change_end(bl, SC_RUN, INVALID_TIMER);
return 1;
}
@@ -774,7 +774,7 @@ int unit_is_walking(struct block_list *bl)
struct unit_data *ud = unit_bl2ud(bl);
nullpo_ret(bl);
if(!ud) return 0;
- return (ud->walktimer != -1);
+ return (ud->walktimer != INVALID_TIMER);
}
/*==========================================
@@ -794,7 +794,7 @@ int unit_can_move(struct block_list *bl)
if (!ud)
return 0;
- if (ud->skilltimer != -1 && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skillid)&INF2_GUILD_SKILL))
+ if (ud->skilltimer != INVALID_TIMER && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skillid)&INF2_GUILD_SKILL))
return 0; // prevent moving while casting
if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
@@ -880,7 +880,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
return 0;
}
ud->canmove_tick = tick + delay;
- if (ud->walktimer != -1)
+ if (ud->walktimer != INVALID_TIMER)
{ //Stop walking, if chasing, readjust timers.
if (delay == 1)
{ //Minimal delay (walk-delay) disabled. Just stop walking.
@@ -989,7 +989,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
return 0;
//Normally not needed because clif.c checks for it, but the at/char/script commands don't! [Skotlex]
- if(ud->skilltimer != -1 && skill_num != SA_CASTCANCEL)
+ if(ud->skilltimer != INVALID_TIMER && skill_num != SA_CASTCANCEL)
return 0;
if(skill_get_inf2(skill_num)&INF2_NO_TARGET_SELF && src->id == target_id)
@@ -1048,7 +1048,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
//Check range when not using skill on yourself or is a combo-skill during attack
//(these are supposed to always have the same range as your attack)
- if( src->id != target_id && (!temp || ud->attacktimer == -1) )
+ if( src->id != target_id && (!temp || ud->attacktimer == INVALID_TIMER) )
{
if( skill_get_state(ud->skillid) == ST_MOVE_ENABLE )
{
@@ -1066,7 +1066,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
if (!temp) //Stop attack on non-combo skills [Skotlex]
unit_stop_attack(src);
- else if(ud->attacktimer != -1) //Elsewise, delay current attack sequence
+ else if(ud->attacktimer != INVALID_TIMER) //Elsewise, delay current attack sequence
ud->attackabletime = tick + status_get_adelay(src);
ud->state.skillcastcancel = castcancel;
@@ -1181,7 +1181,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
if( sc && sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_num != AS_CLOAKING )
{
- status_change_end(src,SC_CLOAKING,-1);
+ status_change_end(src, SC_CLOAKING, INVALID_TIMER);
if (!src->prev) return 0; //Warped away!
}
@@ -1225,7 +1225,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
ud = unit_bl2ud(src);
if(ud == NULL) return 0;
- if(ud->skilltimer != -1) //Normally not needed since clif.c checks for it, but at/char/script commands don't! [Skotlex]
+ if(ud->skilltimer != INVALID_TIMER) //Normally not needed since clif.c checks for it, but at/char/script commands don't! [Skotlex]
return 0;
sc = status_get_sc(src);
@@ -1286,7 +1286,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
if (sc && sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4))
{
- status_change_end(src,SC_CLOAKING,-1);
+ status_change_end(src, SC_CLOAKING, INVALID_TIMER);
if (!src->prev) return 0; //Warped away!
}
@@ -1311,7 +1311,7 @@ int unit_stop_attack(struct block_list *bl)
struct unit_data *ud = unit_bl2ud(bl);
nullpo_ret(bl);
- if(!ud || ud->attacktimer == -1)
+ if(!ud || ud->attacktimer == INVALID_TIMER)
return 0;
delete_timer( ud->attacktimer, unit_attack_timer );
@@ -1381,7 +1381,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
ud->chaserange = status_get_range(src);
//Just change target/type. [Skotlex]
- if(ud->attacktimer != -1)
+ if(ud->attacktimer != INVALID_TIMER)
return 0;
//Set Mob's ANGRY/BERSERK states.
@@ -1392,7 +1392,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
//Do attack next time it is possible. [Skotlex]
ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
else //Attack NOW.
- unit_attack_timer(-1,gettick(),src->id,0);
+ unit_attack_timer(INVALID_TIMER, gettick(), src->id, 0);
return 0;
}
@@ -1403,7 +1403,7 @@ int unit_cancel_combo(struct block_list *bl)
{
struct unit_data *ud;
- if (!status_change_end(bl, SC_COMBO, -1))
+ if (!status_change_end(bl, SC_COMBO, INVALID_TIMER))
return 0; //Combo wasn't active.
ud = unit_bl2ud(bl);
@@ -1411,7 +1411,7 @@ int unit_cancel_combo(struct block_list *bl)
ud->attackabletime = gettick() + status_get_amotion(bl);
- if (ud->attacktimer == -1)
+ if (ud->attacktimer == INVALID_TIMER)
return 1; //Nothing more to do.
delete_timer(ud->attacktimer, unit_attack_timer);
@@ -1564,12 +1564,12 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
return 0;
}
- if( ud->skilltimer != -1 && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
+ if( ud->skilltimer != INVALID_TIMER && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
return 0; // can't attack while casting
if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
{ // attacking when under cast delay has restrictions:
- if( tid == -1 )
+ if( tid == INVALID_TIMER )
{ //requested attack.
if(sd) clif_skill_fail(sd,1,4,0);
return 0;
@@ -1613,14 +1613,14 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
//Sync packet only for players.
//Non-players use the sync packet on the walk timer. [Skotlex]
- if (tid == -1 && sd) clif_fixpos(src);
+ if (tid == INVALID_TIMER && sd) clif_fixpos(src);
if( DIFF_TICK(ud->attackabletime,tick) <= 0 )
{
if (battle_config.attack_direction_change && (src->type&battle_config.attack_direction_change)) {
ud->dir = map_calc_dir(src, target->x,target->y );
}
- if(ud->walktimer != -1)
+ if(ud->walktimer != INVALID_TIMER)
unit_stop_walking(src,1);
if(md) {
if (mobskill_use(md,tick,-1))
@@ -1675,7 +1675,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
int ret=0, skill;
nullpo_ret(bl);
- if (!ud || ud->skilltimer==-1)
+ if (!ud || ud->skilltimer == INVALID_TIMER)
return 0; //Nothing to cancel.
sd = BL_CAST(BL_PC, bl);
@@ -1733,9 +1733,9 @@ void unit_dataset(struct block_list *bl)
memset( ud, 0, sizeof( struct unit_data) );
ud->bl = bl;
- ud->walktimer = -1;
- ud->skilltimer = -1;
- ud->attacktimer = -1;
+ ud->walktimer = INVALID_TIMER;
+ ud->skilltimer = INVALID_TIMER;
+ ud->attacktimer = INVALID_TIMER;
ud->attackabletime =
ud->canact_tick =
ud->canmove_tick = gettick();
@@ -1755,7 +1755,7 @@ static int unit_counttargeted_sub(struct block_list* bl, va_list ap)
ud = unit_bl2ud(bl);
- if (ud && ud->target == id && ud->attacktimer != -1 && ud->attacktarget_lv >= target_lv)
+ if (ud && ud->target == id && ud->attacktimer != INVALID_TIMER && ud->attacktarget_lv >= target_lv)
return 1;
return 0;
@@ -1822,36 +1822,36 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
map_freeblock_lock();
ud->target = 0; //Unlock walk/attack target.
- if (ud->walktimer != -1)
+ if (ud->walktimer != INVALID_TIMER)
unit_stop_walking(bl,0);
- if (ud->attacktimer != -1)
+ if (ud->attacktimer != INVALID_TIMER)
unit_stop_attack(bl);
- if (ud->skilltimer != -1)
+ if (ud->skilltimer != INVALID_TIMER)
unit_skillcastcancel(bl,0);
// Do not reset can-act delay. [Skotlex]
ud->attackabletime = ud->canmove_tick /*= ud->canact_tick*/ = gettick();
if(sc && sc->count ) { //map-change/warp dispells.
- status_change_end(bl,SC_BLADESTOP,-1);
- status_change_end(bl,SC_BASILICA,-1);
- status_change_end(bl,SC_ANKLE,-1);
- status_change_end(bl,SC_TRICKDEAD,-1);
- status_change_end(bl,SC_BLADESTOP_WAIT,-1);
- status_change_end(bl,SC_RUN,-1);
- status_change_end(bl,SC_DANCING,-1);
- status_change_end(bl,SC_WARM,-1);
- status_change_end(bl,SC_DEVOTION,-1);
- status_change_end(bl,SC_MARIONETTE,-1);
- status_change_end(bl,SC_MARIONETTE2,-1);
- status_change_end(bl,SC_CLOSECONFINE,-1);
- status_change_end(bl,SC_CLOSECONFINE2,-1);
- status_change_end(bl,SC_HIDING,-1);
- status_change_end(bl,SC_CLOAKING,-1);
- status_change_end(bl,SC_CHASEWALK,-1);
+ status_change_end(bl, SC_BLADESTOP, INVALID_TIMER);
+ status_change_end(bl, SC_BASILICA, INVALID_TIMER);
+ status_change_end(bl, SC_ANKLE, INVALID_TIMER);
+ status_change_end(bl, SC_TRICKDEAD, INVALID_TIMER);
+ status_change_end(bl, SC_BLADESTOP_WAIT, INVALID_TIMER);
+ status_change_end(bl, SC_RUN, INVALID_TIMER);
+ status_change_end(bl, SC_DANCING, INVALID_TIMER);
+ status_change_end(bl, SC_WARM, INVALID_TIMER);
+ status_change_end(bl, SC_DEVOTION, INVALID_TIMER);
+ status_change_end(bl, SC_MARIONETTE, INVALID_TIMER);
+ status_change_end(bl, SC_MARIONETTE2, INVALID_TIMER);
+ status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
+ status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
+ status_change_end(bl, SC_HIDING, INVALID_TIMER);
+ status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
+ status_change_end(bl, SC_CHASEWALK, INVALID_TIMER);
if (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF)
- status_change_end(bl,SC_GOSPEL,-1);
- status_change_end(bl,SC_CHANGE,-1);
- status_change_end(bl,SC_STOP,-1);
+ status_change_end(bl, SC_GOSPEL, INVALID_TIMER);
+ status_change_end(bl, SC_CHANGE, INVALID_TIMER);
+ status_change_end(bl, SC_STOP, INVALID_TIMER);
}
if (bl->type&BL_CHAR) {
@@ -1891,7 +1891,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
sd->npc_shopid = 0;
sd->adopt_invite = 0;
- if(sd->pvp_timer!=-1) {
+ if(sd->pvp_timer != INVALID_TIMER) {
delete_timer(sd->pvp_timer,pc_calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
sd->pvp_rank = 0;
@@ -2053,7 +2053,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),false);
pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),false);
- if( sd->followtimer != -1 )
+ if( sd->followtimer != INVALID_TIMER )
pc_stop_following(sd);
if( sd->duel_invite > 0 )
@@ -2104,7 +2104,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
}
if( pd->s_skill )
{
- if (pd->s_skill->timer != -1) {
+ if (pd->s_skill->timer != INVALID_TIMER) {
if (pd->s_skill->id)
delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
@@ -2115,14 +2115,14 @@ int unit_free(struct block_list *bl, clr_type clrtype)
}
if( pd->recovery )
{
- if(pd->recovery->timer != -1)
+ if(pd->recovery->timer != INVALID_TIMER)
delete_timer(pd->recovery->timer, pet_recovery_timer);
aFree(pd->recovery);
pd->recovery = NULL;
}
if( pd->bonus )
{
- if (pd->bonus->timer != -1)
+ if (pd->bonus->timer != INVALID_TIMER)
delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
aFree(pd->bonus);
pd->bonus = NULL;