summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-25 21:26:54 +0200
committerHaru <haru@dotalux.com>2013-09-25 22:15:53 +0200
commitafcad494411995396b906f214d1c4ffcf485cc0a (patch)
treee70b21658276ddef885322b7c9b18935b6c0235e /src/map/pc.c
parent13afb7e0bf35bacc9c90c7dffe34120ddd2fd099 (diff)
downloadhercules-afcad494411995396b906f214d1c4ffcf485cc0a.tar.gz
hercules-afcad494411995396b906f214d1c4ffcf485cc0a.tar.bz2
hercules-afcad494411995396b906f214d1c4ffcf485cc0a.tar.xz
hercules-afcad494411995396b906f214d1c4ffcf485cc0a.zip
Renamed local variables that would conflict with a rename of iStatus to status
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c123
1 files changed, 60 insertions, 63 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 441230c29..c485baa43 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -444,20 +444,20 @@ unsigned char pc_famerank(int char_id, int job)
}
int pc_setrestartvalue(struct map_session_data *sd,int type) {
- struct status_data *status, *b_status;
+ struct status_data *st, *bst;
nullpo_ret(sd);
- b_status = &sd->base_status;
- status = &sd->battle_status;
+ bst = &sd->base_status;
+ st = &sd->battle_status;
if (type&1) { //Normal resurrection
- status->hp = 1; //Otherwise iStatus->heal may fail if dead.
- iStatus->heal(&sd->bl, b_status->hp, 0, 1);
- if( status->sp < b_status->sp )
- iStatus->set_sp(&sd->bl, b_status->sp, 1);
+ st->hp = 1; //Otherwise iStatus->heal may fail if dead.
+ iStatus->heal(&sd->bl, bst->hp, 0, 1);
+ if( st->sp < bst->sp )
+ iStatus->set_sp(&sd->bl, bst->sp, 1);
} else { //Just for saving on the char-server (with values as if respawned)
- sd->status.hp = b_status->hp;
- sd->status.sp = (status->sp < b_status->sp)?b_status->sp:status->sp;
+ sd->status.hp = bst->hp;
+ sd->status.sp = (st->sp < bst->sp) ? bst->sp : st->sp;
}
return 0;
}
@@ -2100,13 +2100,12 @@ int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate,
/*==========================================
* Add a bonus(type) to player sd
*------------------------------------------*/
-int pc_bonus(struct map_session_data *sd,int type,int val)
-{
- struct status_data *status;
+int pc_bonus(struct map_session_data *sd,int type,int val) {
+ struct status_data *bst;
int bonus;
nullpo_ret(sd);
- status = &sd->base_status;
+ bst = &sd->base_status;
switch(type){
case SP_STR:
@@ -2120,57 +2119,57 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_ATK1:
if(!sd->state.lr_flag) {
- bonus = status->rhw.atk + val;
- status->rhw.atk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->rhw.atk + val;
+ bst->rhw.atk = cap_value(bonus, 0, USHRT_MAX);
}
else if(sd->state.lr_flag == 1) {
- bonus = status->lhw.atk + val;
- status->lhw.atk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->lhw.atk + val;
+ bst->lhw.atk = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_ATK2:
if(!sd->state.lr_flag) {
- bonus = status->rhw.atk2 + val;
- status->rhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->rhw.atk2 + val;
+ bst->rhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
}
else if(sd->state.lr_flag == 1) {
- bonus = status->lhw.atk2 + val;
- status->lhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->lhw.atk2 + val;
+ bst->lhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_BASE_ATK:
if(sd->state.lr_flag != 2) {
#ifdef RENEWAL
- status->equip_atk += val;
+ bst->equip_atk += val;
#else
- bonus = status->batk + val;
- status->batk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = bst->batk + val;
+ bst->batk = cap_value(bonus, 0, USHRT_MAX);
#endif
}
break;
case SP_DEF1:
if(sd->state.lr_flag != 2) {
- bonus = status->def + val;
+ bonus = bst->def + val;
#ifdef RENEWAL
- status->def = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bst->def = cap_value(bonus, SHRT_MIN, SHRT_MAX);
#else
- status->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
+ bst->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
#endif
}
break;
case SP_DEF2:
if(sd->state.lr_flag != 2) {
- bonus = status->def2 + val;
- status->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->def2 + val;
+ bst->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_MDEF1:
if(sd->state.lr_flag != 2) {
- bonus = status->mdef + val;
+ bonus = bst->mdef + val;
#ifdef RENEWAL
- status->mdef = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bst->mdef = cap_value(bonus, SHRT_MIN, SHRT_MAX);
#else
- status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
+ bst->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
#endif
if( sd->state.lr_flag == 3 ) {//Shield, used for royal guard
sd->bonus.shieldmdef += bonus;
@@ -2179,33 +2178,33 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_MDEF2:
if(sd->state.lr_flag != 2) {
- bonus = status->mdef2 + val;
- status->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->mdef2 + val;
+ bst->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_HIT:
if(sd->state.lr_flag != 2) {
- bonus = status->hit + val;
- status->hit = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->hit + val;
+ bst->hit = cap_value(bonus, SHRT_MIN, SHRT_MAX);
} else
sd->bonus.arrow_hit+=val;
break;
case SP_FLEE1:
if(sd->state.lr_flag != 2) {
- bonus = status->flee + val;
- status->flee = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->flee + val;
+ bst->flee = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_FLEE2:
if(sd->state.lr_flag != 2) {
- bonus = status->flee2 + val*10;
- status->flee2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->flee2 + val*10;
+ bst->flee2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_CRITICAL:
if(sd->state.lr_flag != 2) {
- bonus = status->cri + val*10;
- status->cri = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ bonus = bst->cri + val*10;
+ bst->cri = cap_value(bonus, SHRT_MIN, SHRT_MAX);
} else
sd->bonus.arrow_cri += val*10;
break;
@@ -2214,8 +2213,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
ShowError("pc_bonus: SP_ATKELE: Invalid element %d\n", val);
break;
}
- switch (sd->state.lr_flag)
- {
+ switch (sd->state.lr_flag) {
case 2:
switch (sd->status.weapon) {
case W_BOW:
@@ -2225,7 +2223,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case W_SHOTGUN:
case W_GRENADE:
//Become weapon element.
- status->rhw.ele=val;
+ bst->rhw.ele=val;
break;
default: //Become arrow element.
sd->bonus.arrow_ele=val;
@@ -2233,10 +2231,10 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
}
break;
case 1:
- status->lhw.ele=val;
+ bst->lhw.ele=val;
break;
default:
- status->rhw.ele=val;
+ bst->rhw.ele=val;
break;
}
break;
@@ -2246,21 +2244,21 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
}
if(sd->state.lr_flag != 2)
- status->def_ele=val;
+ bst->def_ele=val;
break;
case SP_MAXHP:
if(sd->state.lr_flag == 2)
break;
- val += (int)status->max_hp;
+ val += (int)bst->max_hp;
//Negative bonuses will underflow, this will be handled in status_calc_pc through casting
//If this is called outside of status_calc_pc, you'd better pray they do not underflow and end with UINT_MAX max_hp.
- status->max_hp = (unsigned int)val;
+ bst->max_hp = (unsigned int)val;
break;
case SP_MAXSP:
if(sd->state.lr_flag == 2)
break;
- val += (int)status->max_sp;
- status->max_sp = (unsigned int)val;
+ val += (int)bst->max_sp;
+ bst->max_sp = (unsigned int)val;
break;
#ifndef RENEWAL_CAST
case SP_VARCASTRATE:
@@ -2291,14 +2289,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case W_GATLING:
case W_SHOTGUN:
case W_GRENADE:
- status->rhw.range += val;
+ bst->rhw.range += val;
}
break;
case 1:
- status->lhw.range += val;
+ bst->lhw.range += val;
break;
default:
- status->rhw.range += val;
+ bst->rhw.range += val;
break;
}
break;
@@ -2317,9 +2315,9 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case SP_ASPD_RATE: //Stackable increase - Made it linear as per rodatazone
if(sd->state.lr_flag != 2)
#ifndef RENEWAL_ASPD
- status->aspd_rate -= 10*val;
+ bst->aspd_rate -= 10*val;
#else
- status->aspd_rate2 += val;
+ bst->aspd_rate2 += val;
#endif
break;
case SP_HP_RECOV_RATE:
@@ -5855,14 +5853,13 @@ int pc_checkjoblevelup(struct map_session_data *sd)
/*==========================================
* Alters experienced based on self bonuses that do not get even shared to the party.
*------------------------------------------*/
-static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src)
-{
+static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) {
int bonus = 0;
- struct status_data *status = iStatus->get_status_data(src);
+ struct status_data *st = iStatus->get_status_data(src);
- if (sd->expaddrace[status->race])
- bonus += sd->expaddrace[status->race];
- bonus += sd->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
+ if (sd->expaddrace[st->race])
+ bonus += sd->expaddrace[st->race];
+ bonus += sd->expaddrace[st->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
if (battle_config.pk_mode &&
(int)(iStatus->get_lv(src) - sd->status.base_level) >= 20)