summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/guild.c30
-rw-r--r--src/map/homunculus.c11
-rw-r--r--src/map/intif.c2
-rw-r--r--src/map/mercenary.c18
-rw-r--r--src/map/mob.c12
-rw-r--r--src/map/party.c27
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/skill.c42
-rw-r--r--src/map/status.c42
10 files changed, 104 insertions, 86 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a9b071fda..839fb6ce0 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8430,7 +8430,7 @@ ACMD(cashmount)
clif->message(sd->fd,msg_fd(fd,1362)); // NOTICE: If you crash with mount your LUA is outdated.
if (!sd->sc.data[SC_ALL_RIDING]) {
clif->message(sd->fd,msg_fd(fd,1363)); // You have mounted.
- sc_start(NULL,&sd->bl,SC_ALL_RIDING,100,25,-1);
+ sc_start(NULL, &sd->bl, SC_ALL_RIDING, 100, 25, INFINITE_DURATION);
} else {
clif->message(sd->fd,msg_fd(fd,1364)); // You have released your mount.
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
@@ -9299,7 +9299,7 @@ ACMD(costume){
return false;
}
- sc_start(NULL,&sd->bl, name2id[k], 100, 0, -1);
+ sc_start(NULL, &sd->bl, name2id[k], 100, 0, INFINITE_DURATION);
return true;
}
diff --git a/src/map/guild.c b/src/map/guild.c
index f14ee4611..13acfc0db 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -235,10 +235,13 @@ int guild_getindex(const struct guild *g, int account_id, int char_id)
int i;
if( g == NULL )
- return -1;
+ return INDEX_NOT_FOUND;
ARR_FIND( 0, g->max_member, i, g->member[i].account_id == account_id && g->member[i].char_id == char_id );
- return( i < g->max_member ) ? i : -1;
+ if (i == g->max_member)
+ return INDEX_NOT_FOUND;
+
+ return i;
}
/// lookup: player sd -> member position
@@ -286,9 +289,8 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
c = DB->data2ptr(data);
- if (
- (g = guild->search(c->guild_id)) == NULL ||
- (i = guild->getindex(g, c->account_id, c->char_id)) < 0
+ if ((g = guild->search(c->guild_id)) == NULL
+ || (i = guild->getindex(g, c->account_id, c->char_id)) == INDEX_NOT_FOUND
) {
ers_free(guild->expcache_ers, c);
return 0;
@@ -447,7 +449,7 @@ int guild_check_member(const struct guild *g)
continue;
i = guild->getindex(g,sd->status.account_id,sd->status.char_id);
- if (i < 0) {
+ if (i == INDEX_NOT_FOUND) {
sd->status.guild_id=0;
sd->guild_emblem_id=0;
ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name);
@@ -754,9 +756,9 @@ void guild_member_joined(struct map_session_data *sd)
guild->block_skill(sd, 300000);
}
i = guild->getindex(g, sd->status.account_id, sd->status.char_id);
- if (i == -1)
+ if (i == INDEX_NOT_FOUND) {
sd->status.guild_id = 0;
- else {
+ } else {
g->member[i].sd = sd;
sd->guild = g;
@@ -876,7 +878,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
// find the member and perform expulsion
i = guild->getindex(g, account_id, char_id);
- if( i != -1 && strcmp(g->member[i].name,g->master) != 0 ) //Can't expel the GL!
+ if (i != INDEX_NOT_FOUND && strcmp(g->member[i].name,g->master) != 0) //Can't expel the GL!
intif->guild_leave(g->guild_id,account_id,char_id,1,mes);
return 0;
@@ -893,7 +895,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
return 0; // no such guild (error!)
i = guild->getindex(g, account_id, char_id);
- if( i == -1 )
+ if (i == INDEX_NOT_FOUND)
return 0; // not a member (inconsistency!)
online_member_sd = guild->getavailablesd(g);
@@ -976,8 +978,8 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_);
if(!online){
- int i=guild->getindex(g,sd->status.account_id,sd->status.char_id);
- if(i>=0)
+ int i = guild->getindex(g,sd->status.account_id,sd->status.char_id);
+ if (i != INDEX_NOT_FOUND)
g->member[i].sd=NULL;
else
ShowError("guild_send_memberinfoshort: Failed to locate member %d:%d in guild %d!\n", sd->status.account_id, sd->status.char_id, g->guild_id);
@@ -994,7 +996,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
{ // cleaned up [LuzZza]
- int i,alv,c,idx=-1,om=0,oldonline=-1;
+ int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1;
struct guild *g = guild->search(guild_id);
if(g == NULL)
@@ -1016,7 +1018,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
om++;
}
- if(idx == -1 || c == 0) {
+ if (idx == INDEX_NOT_FOUND || c == 0) {
//Treat char_id who doesn't match guild_id (not found as member)
struct map_session_data *sd = map->id2sd(account_id);
if(sd && sd->status.char_id == char_id) {
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index d10cea64a..bda8fd9e6 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -399,7 +399,7 @@ bool homunculus_levelup(struct homun_data *hd) {
int homunculus_change_class(struct homun_data *hd, short class_) {
int i = homun->db_search(class_,HOMUNCULUS_CLASS);
nullpo_retr(0, hd);
- if(i < 0)
+ if (i == INDEX_NOT_FOUND)
return 0;
hd->homunculusDB = &homun->dbs->db[i];
hd->homunculus.class_ = class_;
@@ -769,10 +769,10 @@ int homunculus_db_search(int key,int type) {
return i;
break;
default:
- return -1;
+ return INDEX_NOT_FOUND;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -797,7 +797,7 @@ bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *h
Assert_retr(false, sd->status.hom_id == 0 || sd->hd == 0 || sd->hd->master == sd);
i = homun->db_search(hom->class_,HOMUNCULUS_CLASS);
- if(i < 0) {
+ if (i == INDEX_NOT_FOUND) {
ShowError("homunculus_create: unknown class [%d] for homunculus '%s', requesting deletion.\n", hom->class_, hom->name);
sd->status.hom_id = 0;
intif->homunculus_requestdelete(hom->hom_id);
@@ -948,7 +948,8 @@ bool homunculus_creation_request(struct map_session_data *sd, int class_) {
nullpo_retr(false, sd);
i = homun->db_search(class_,HOMUNCULUS_CLASS);
- if(i < 0) return false;
+ if (i == INDEX_NOT_FOUND)
+ return false;
memset(&hom, 0, sizeof(struct s_homunculus));
//Initial data
diff --git a/src/map/intif.c b/src/map/intif.c
index 4445d04e0..d20afbb08 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1346,7 +1346,7 @@ void intif_parse_GuildMemberInfoChanged(int fd) {
return;
idx = guild->getindex(g,account_id,char_id);
- if( idx == -1 )
+ if (idx == INDEX_NOT_FOUND)
return;
switch( type ) {
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index ec0b2291f..fa337e13b 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -66,19 +66,23 @@ int merc_search_index(int class_)
{
int i;
ARR_FIND(0, MAX_MERCENARY_CLASS, i, mercenary->db[i].class_ == class_);
- return (i == MAX_MERCENARY_CLASS)?-1:i;
+ if (i == MAX_MERCENARY_CLASS)
+ return INDEX_NOT_FOUND;
+ return i;
}
bool merc_class(int class_)
{
- return (bool)(mercenary->search_index(class_) > -1);
+ if (mercenary->search_index(class_) != INDEX_NOT_FOUND)
+ return true;
+ return false;
}
struct view_data * merc_get_viewdata(int class_)
{
int i = mercenary->search_index(class_);
- if( i < 0 )
- return 0;
+ if (i == INDEX_NOT_FOUND)
+ return NULL;
return &mercenary->db[i].vd;
}
@@ -90,7 +94,7 @@ int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime)
int i;
nullpo_retr(0,sd);
- if( (i = mercenary->search_index(class_)) < 0 )
+ if ((i = mercenary->search_index(class_)) == INDEX_NOT_FOUND)
return 0;
db = &mercenary->db[i];
@@ -310,8 +314,8 @@ int merc_data_received(const struct s_mercenary *merc, bool flag)
if( (sd = map->charid2sd(merc->char_id)) == NULL )
return 0;
- if( !flag || i < 0 )
- { // Not created - loaded - DB info
+ if (!flag || i == INDEX_NOT_FOUND) {
+ // Not created - loaded - DB info
sd->status.mer_id = 0;
return 0;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index b2f52f634..063a1ff6e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2987,18 +2987,20 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id)
/*==========================================
* MOBskill lookup (get skillindex through skill_id)
- * Returns -1 if not found.
+ * Returns INDEX_NOT_FOUND if not found.
*------------------------------------------*/
int mob_skill_id2skill_idx(int class_,uint16 skill_id)
{
int i, max = mob->db(class_)->maxskill;
struct mob_skill *ms=mob->db(class_)->skill;
- if(ms==NULL)
- return -1;
+ if (ms == NULL)
+ return INDEX_NOT_FOUND;
- ARR_FIND( 0, max, i, ms[i].skill_id == skill_id );
- return ( i < max ) ? i : -1;
+ ARR_FIND(0, max, i, ms[i].skill_id == skill_id);
+ if (i == max)
+ return INDEX_NOT_FOUND;
+ return i;
}
/*==========================================
diff --git a/src/map/party.c b/src/map/party.c
index 39c6e25fb..77f3c2b0b 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -67,18 +67,27 @@ void party_fill_member(struct party_member* member, struct map_session_data* sd,
member->online = 1;
member->leader = leader;
}
-/// Get the member_id of a party member.
-/// Return -1 if not in party.
-int party_getmemberid(struct party_data* p, struct map_session_data* sd) {
+
+/**
+ * Gets the member_id of a party member.
+ *
+ * @param p Party data.
+ * @param sd Member data.
+ * @return the member_id.
+ * @retval INDEX_NOT_FOUND if not in party.
+ */
+int party_getmemberid(struct party_data *p, struct map_session_data *sd)
+{
int member_id;
- nullpo_retr(-1, p);
- if( sd == NULL )
- return -1;// no player
+ nullpo_retr(INDEX_NOT_FOUND, p);
+
+ if (sd == NULL)
+ return INDEX_NOT_FOUND; // no player
ARR_FIND(0, MAX_PARTY, member_id,
p->party.member[member_id].account_id == sd->status.account_id &&
p->party.member[member_id].char_id == sd->status.char_id);
- if( member_id == MAX_PARTY )
- return -1;// not found
+ if (member_id == MAX_PARTY)
+ return INDEX_NOT_FOUND; // not found
return member_id;
}
@@ -326,7 +335,7 @@ int party_recv_info(const struct party *sp, int char_id)
if( char_id != 0 ) {
// requester
sd = map->charid2sd(char_id);
- if( sd && sd->status.party_id == sp->party_id && party->getmemberid(p,sd) == -1 )
+ if (sd != NULL && sd->status.party_id == sp->party_id && party->getmemberid(p,sd) == INDEX_NOT_FOUND)
sd->status.party_id = 0;// was not in the party
}
return 0;
diff --git a/src/map/script.c b/src/map/script.c
index 9388e8f5f..9ad1064f4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18500,7 +18500,7 @@ BUILDIN(setcashmount)
if (sd->sc.data[SC_ALL_RIDING])
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
else
- sc_start(NULL,&sd->bl, SC_ALL_RIDING, 100, 25, -1);
+ sc_start(NULL, &sd->bl, SC_ALL_RIDING, 100, 25, INFINITE_DURATION);
script_pushint(st,1);//in both cases, return 1.
}
return true;
diff --git a/src/map/skill.c b/src/map/skill.c
index 68cb3ff0e..366d66234 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2833,7 +2833,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
if ( ssc->data[SC_POISONINGWEAPON]->val1 == 9 )// Oblivion Curse gives a 2nd success chance after the 1st one passes which is reducible. [Rytech]
rate = 100 - tstatus->int_ * 4 / 5;
sc_start(src, bl,ssc->data[SC_POISONINGWEAPON]->val2,rate,ssc->data[SC_POISONINGWEAPON]->val1,skill->get_time2(GC_POISONINGWEAPON,1) - (tstatus->vit + tstatus->luk) / 2 * 1000);
- status_change_end(src,SC_POISONINGWEAPON,-1);
+ status_change_end(src, SC_POISONINGWEAPON, INVALID_TIMER);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
}
@@ -5401,12 +5401,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
type = status->skill2sc(skill_id);
tsc = status->get_sc(bl);
- tsce = (tsc && type != -1)?tsc->data[type]:NULL;
+ tsce = (tsc != NULL && type != SC_NONE) ? tsc->data[type] : NULL;
- if (src!=bl && type > -1 &&
- (element = skill->get_ele(skill_id, skill_lv)) > ELE_NEUTRAL &&
- skill->get_inf(skill_id) != INF_SUPPORT_SKILL &&
- battle->attr_fix(NULL, NULL, 100, element, tstatus->def_ele, tstatus->ele_lv) <= 0)
+ if (src != bl && type > SC_NONE
+ && (element = skill->get_ele(skill_id, skill_lv)) > ELE_NEUTRAL
+ && skill->get_inf(skill_id) != INF_SUPPORT_SKILL
+ && battle->attr_fix(NULL, NULL, 100, element, tstatus->def_ele, tstatus->ele_lv) <= 0)
return 1; //Skills that cause an status should be blocked if the target element blocks its element.
map->freeblock_lock();
@@ -7297,7 +7297,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
case NPC_REBIRTH:
if( md && md->state.rebirth )
break; // only works once
- sc_start(src,bl,type,100,skill_lv,-1);
+ sc_start(src, bl, type, 100, skill_lv, INFINITE_DURATION);
break;
case NPC_DARKBLESSING:
@@ -8648,7 +8648,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;
}
- sc_start(src, bl, SC_STOP, 100, skill_lv, INVALID_TIMER); //Can't move while selecting a spellbook.
+ sc_start(src, bl, SC_STOP, 100, skill_lv, INFINITE_DURATION); //Can't move while selecting a spellbook.
clif->spellbook_list(sd);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
@@ -8777,7 +8777,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if( sd ) {
int idx1 = skill->get_index(sd->reproduceskill_id), idx2 = skill->get_index(sd->cloneskill_id);
if( sd->status.skill[idx1].id || sd->status.skill[idx2].id ) {
- sc_start(src,src,SC_STOP,100,skill_lv,-1);// The skill_lv is stored in val1 used in skill_select_menu to determine the used skill lvl [Xazax]
+ sc_start(src, src, SC_STOP, 100, skill_lv, INFINITE_DURATION); // The skill_lv is stored in val1 used in skill_select_menu to determine the used skill lvl [Xazax]
clif->autoshadowspell_list(sd);
clif->skill_nodamage(src,bl,skill_id,1,1);
}
@@ -8894,7 +8894,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
splashrange = 3;
switch( opt ) {
case 1:
- sc_start(src,bl,SC_SHIELDSPELL_DEF,100,opt,INVALID_TIMER); //Splash AoE ATK
+ sc_start(src, bl, SC_SHIELDSPELL_DEF, 100, opt, INFINITE_DURATION); // Splash AoE ATK
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, BDT_SKILL);
map->foreachinrange(skill->area_sub,src,splashrange,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER);
@@ -8921,7 +8921,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
splashrange = 3;
switch( opt ) {
case 1:
- sc_start(src,bl,SC_SHIELDSPELL_MDEF,100,opt,INVALID_TIMER); //Splash AoE MATK
+ sc_start(src, bl, SC_SHIELDSPELL_MDEF, 100, opt, INFINITE_DURATION); // Splash AoE MATK
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, BDT_SKILL);
map->foreachinrange(skill->area_sub,src,splashrange,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
status_change_end(bl,SC_SHIELDSPELL_MDEF,INVALID_TIMER);
@@ -8958,7 +8958,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
sc_start(src,bl,SC_SCRESIST,100,rate,shield->refine * 30000));
break;
case 3:
- sc_start(src,bl,SC_SHIELDSPELL_REF,100,opt,INVALID_TIMER); //HP Recovery
+ sc_start(src, bl, SC_SHIELDSPELL_REF, 100, opt, INFINITE_DURATION); // HP Recovery
val = sstatus->max_hp * ((status->get_lv(src) / 10) + (shield->refine + 1)) / 100;
status->heal(bl, val, 0, 2);
status_change_end(bl,SC_SHIELDSPELL_REF,INVALID_TIMER);
@@ -10267,7 +10267,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
sc = status->get_sc(src);
type = status->skill2sc(skill_id);
- sce = (sc && type != -1)?sc->data[type]:NULL;
+ sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL;
switch (skill_id) { //Skill effect.
case WZ_METEOR:
@@ -11670,7 +11670,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick
return 0;
type = status->skill2sc(sg->skill_id);
- sce = (sc && type != -1)?sc->data[type]:NULL;
+ sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL;
skill_id = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still.
switch (sg->unit_id) {
case UNT_SPIDERWEB:
@@ -12668,7 +12668,7 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick)
nullpo_ret(sg=src->group);
sc = status->get_sc(bl);
type = status->skill2sc(sg->skill_id);
- sce = (sc && type != -1)?sc->data[type]:NULL;
+ sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL;
if( bl->prev == NULL
|| (status->isdead(bl) && sg->unit_id != UNT_ANKLESNARE && sg->unit_id != UNT_SPIDERWEB && sg->unit_id != UNT_THORNS_TRAP)
@@ -12732,7 +12732,7 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) {
sc = NULL;
type = status->skill2sc(skill_id);
- sce = (sc && type != -1)?sc->data[type]:NULL;
+ sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL;
switch (skill_id) {
case WZ_QUAGMIRE:
@@ -17725,7 +17725,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
return 0;
}
- status_change_end(&sd->bl, SC_POISONINGWEAPON, -1);//Status must be forced to end so that a new poison will be applied if a player decides to change poisons. [Rytech]
+ status_change_end(&sd->bl, SC_POISONINGWEAPON, INVALID_TIMER); // Status must be forced to end so that a new poison will be applied if a player decides to change poisons. [Rytech]
chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv
sc_start4(&sd->bl, &sd->bl, SC_POISONINGWEAPON, 100, pc->checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1
type, chance, 0, skill->get_time(GC_POISONINGWEAPON, sd->menuskill_val));
@@ -17845,13 +17845,13 @@ int skill_spellbook (struct map_session_data *sd, int nameid) {
for(i = SC_SPELLBOOK7; i >= SC_SPELLBOOK1; i--){ // This is how official saves spellbook. [malufett]
if( !sc->data[i] ){
sc->data[SC_READING_SB]->val2 += point; // increase points
- sc_start4(&sd->bl,&sd->bl, (sc_type)i, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
+ sc_start4(&sd->bl, &sd->bl, (sc_type)i, 100, skill_id, pc->checkskill(sd, skill_id), point, 0, INFINITE_DURATION);
break;
}
}
- }else{
- sc_start2(&sd->bl,&sd->bl, SC_READING_SB, 100, 0, point, INVALID_TIMER);
- sc_start4(&sd->bl,&sd->bl, SC_SPELLBOOK7, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
+ } else {
+ sc_start2(&sd->bl, &sd->bl, SC_READING_SB, 100, 0, point, INFINITE_DURATION);
+ sc_start4(&sd->bl, &sd->bl, SC_SPELLBOOK7, 100, skill_id, pc->checkskill(sd, skill_id), point, 0, INFINITE_DURATION);
}
return 1;
diff --git a/src/map/status.c b/src/map/status.c
index bef808d11..d0b84f1b8 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -8043,23 +8043,23 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
}
}
//val4 signals infinite endure (if val4 == 2 it is infinite endure from Berserk)
- if( val4 )
- tick = -1;
+ if (val4)
+ tick = INFINITE_DURATION;
break;
case SC_AUTOBERSERK:
if (st->hp < st->max_hp>>2 &&
(!sc->data[SC_PROVOKE] || sc->data[SC_PROVOKE]->val2==0))
sc_start4(src,bl,SC_PROVOKE,100,10,1,0,0,60000);
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_CRUCIS:
val2 = 10 + 4*val1; //Def reduction
- tick = -1;
+ tick = INFINITE_DURATION;
clif->emotion(bl,E_SWT);
break;
case SC_MAXIMIZEPOWER:
tick_time = val2 = tick>0?tick:60000;
- tick = -1; // duration sent to the client should be infinite
+ tick = INFINITE_DURATION; // duration sent to the client should be infinite
break;
case SC_EDP: // [Celest]
//Chance to Poison enemies.
@@ -8100,7 +8100,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
break;
case SC_SACRIFICE:
val2 = 5; //Lasts 5 hits
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_ENCHANTPOISON:
val2= 250+50*val1; //Poisoning Chance (2.5+0.5%) in 1/10000 rate
@@ -8353,7 +8353,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
if (!sd) //Monsters should be able to walk with no penalties. [Skotlex]
val1 = 10;
tick_time = val2 = tick>0?tick:60000; //SP consumption rate.
- tick = -1; // duration sent to the client should be infinite
+ tick = INFINITE_DURATION; // duration sent to the client should be infinite
val3 = 0; // unused, previously walk speed adjustment
//val4&1 signals the presence of a wall.
//val4&2 makes cloak not end on normal attacks [Skotlex]
@@ -8384,7 +8384,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_TURNKICK_READY:
case SC_DODGE_READY:
case SC_PUSH_CART:
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_AUTOGUARD:
@@ -8438,7 +8438,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
val2 = 12; //SP cost
val4 = 10000; //Decrease at 10secs intervals.
val3 = tick/val4;
- tick = -1; // duration sent to the client should be infinite
+ tick = INFINITE_DURATION; // duration sent to the client should be infinite
tick_time = val4; // [GodLesZ] tick time
break;
case SC_PARRYING:
@@ -8534,12 +8534,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_SWORDREJECT:
val2 = 15*val1; //Reflect chance
val3 = 3; //Reflections
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_MEMORIZE:
val2 = 5; //Memorized casts.
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_GRAVITATION:
@@ -8652,7 +8652,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
val3 = (int)(currenttick&0x00000000ffffffffLL);
val4 = (int)((currenttick&0xffffffff00000000LL)>>32);
}
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_KAAHI:
val2 = 200*val1; //HP heal
@@ -8667,7 +8667,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
break;
case SC_TRICKDEAD:
if (vd) vd->dead_sit = 1;
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_CONCENTRATION:
val2 = 2 + val1;
@@ -9060,7 +9060,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
val3 = (int)(currenttick&0x00000000ffffffffLL);
val4 = (int)((currenttick&0xffffffff00000000LL)>>32);
}
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC__REPRODUCE:
val4 = tick / 1000;
@@ -9257,7 +9257,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_FORCEOFVANGUARD:
val2 = 8 + 12 * val1; // Chance
val3 = 5 + 2 * val1; // Max rage counters
- tick = -1; //endless duration in the client
+ tick = INFINITE_DURATION; //endless duration in the client
break;
case SC_EXEEDBREAK:
if( sd ){
@@ -9523,7 +9523,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
break;
case SC_NEUTRALBARRIER:
tick_time = tick;
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_GOLDENE_FERSE:
val2 = 10 + 10*val1; //max hp bonus
@@ -9555,7 +9555,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
sc_start(src, bl, SC_ENDURE, 100, val1, tick); //start endure for same duration
break;
case SC_STYLE_CHANGE: //[Lighta] need real info
- tick = -1;
+ tick = INFINITE_DURATION;
if(val2 == MH_MD_FIGHTING) val2 = MH_MD_GRAPPLING;
else val2 = MH_MD_FIGHTING;
break;
@@ -9591,7 +9591,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
val1 = MOBID_PORING;
break;
case SC_ALL_RIDING:
- tick = -1;
+ tick = INFINITE_DURATION;
break;
case SC_FLASHCOMBO:
/**
@@ -10594,7 +10594,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
// need to do it here.
if( sd ) {
map->quit(sd);
- // Because map->quit calls status_change_end with tid -1
+ // Because map->quit calls status_change_end with tid INVALID_TIMER
// from here it's not neccesary to continue
return 1;
}
@@ -10624,7 +10624,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_WHITEIMPRISON:
{
struct block_list* src = map->id2bl(sce->val2);
- if( tid == -1 || !src)
+ if (tid == INVALID_TIMER || src == NULL)
break; // Terminated by Damage
status_fix_damage(src,bl,400*sce->val1,clif->damage(bl,bl,0,0,400*sce->val1,0,BDT_NORMAL,0));
}
@@ -10634,7 +10634,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
struct unit_data *ud = unit->bl2ud(bl);
if (ud) {
ud->state.running = 0;
- if (ud->walktimer != -1)
+ if (ud->walktimer != INVALID_TIMER)
unit->stop_walking(bl, STOPWALKING_FLAG_FIXPOS);
}
}