summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-07-14 03:28:53 +0200
committerHaru <haru@dotalux.com>2016-07-14 03:28:53 +0200
commit7bcb379c83327331bda05a23000dc0a6bbbefa48 (patch)
tree5c0911e81606e0c41008a7f8e0b990114ae24051 /src/map
parent968e3cddbd3394607ae34f56ba8ee12d78bad1a5 (diff)
downloadhercules-7bcb379c83327331bda05a23000dc0a6bbbefa48.tar.gz
hercules-7bcb379c83327331bda05a23000dc0a6bbbefa48.tar.bz2
hercules-7bcb379c83327331bda05a23000dc0a6bbbefa48.tar.xz
hercules-7bcb379c83327331bda05a23000dc0a6bbbefa48.zip
Changed mmo_charstatus::base_level and mmo_charstatus::job_level to int
Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c22
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/chat.c4
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/pc.c48
-rw-r--r--src/map/skill.c4
-rw-r--r--src/map/status.c6
7 files changed, 45 insertions, 47 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 18ea6cc01..a0ecef9af 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1364,17 +1364,17 @@ ACMD(baselevelup)
}
if (level > 0) {
- if ((int)sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris // FIXME
+ if (sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris
clif->message(fd, msg_fd(fd,47)); // Base level can't go any higher.
return false;
} // End Addition
- if (level > pc->maxbaselv(sd) || level > pc->maxbaselv(sd) - (int)sd->status.base_level) // fix positive overflow // FIXME
- level = pc->maxbaselv(sd) - (int)sd->status.base_level; // FIXME
+ if (level > pc->maxbaselv(sd) || level > pc->maxbaselv(sd) - sd->status.base_level) // fix positive overflow
+ level = pc->maxbaselv(sd) - sd->status.base_level;
for (i = 0; i < level; i++)
status_point += pc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += status_point;
- sd->status.base_level += (unsigned int)level;
+ sd->status.base_level += level;
status_calc_pc(sd, SCO_FORCE);
status_percent_heal(&sd->bl, 100, 100);
clif->misceffect(&sd->bl, 0);
@@ -1385,7 +1385,7 @@ ACMD(baselevelup)
return false;
}
level*=-1;
- if ((unsigned int)level >= sd->status.base_level)
+ if (level >= sd->status.base_level)
level = sd->status.base_level-1;
for (i = 0; i > -level; i--)
status_point += pc->gets_status_point(sd->status.base_level + i - 1);
@@ -1395,7 +1395,7 @@ ACMD(baselevelup)
sd->status.status_point = 0;
else
sd->status.status_point -= status_point;
- sd->status.base_level -= (unsigned int)level;
+ sd->status.base_level -= level;
clif->message(fd, msg_fd(fd,22)); // Base level lowered.
status_calc_pc(sd, SCO_FORCE);
}
@@ -1422,13 +1422,13 @@ ACMD(joblevelup)
return false;
}
if (level > 0) {
- if ((int)sd->status.job_level >= pc->maxjoblv(sd)) { // FIXME
+ if (sd->status.job_level >= pc->maxjoblv(sd)) {
clif->message(fd, msg_fd(fd,23)); // Job level can't go any higher.
return false;
}
- if (level > pc->maxjoblv(sd) || level > pc->maxjoblv(sd) - (int)sd->status.job_level) // fix positive overflow // FIXME
+ if (level > pc->maxjoblv(sd) || level > pc->maxjoblv(sd) - sd->status.job_level) // fix positive overflow
level = pc->maxjoblv(sd) - sd->status.job_level;
- sd->status.job_level += (unsigned int)level;
+ sd->status.job_level += level;
sd->status.skill_point += level;
clif->misceffect(&sd->bl, 1);
clif->message(fd, msg_fd(fd,24)); // Job level raised.
@@ -1438,9 +1438,9 @@ ACMD(joblevelup)
return false;
}
level *=-1;
- if ((unsigned int)level >= sd->status.job_level) // fix negative overflow
+ if (level >= sd->status.job_level) // fix negative overflow
level = sd->status.job_level-1;
- sd->status.job_level -= (unsigned int)level;
+ sd->status.job_level -= level;
if (sd->status.skill_point < level)
pc->resetskill(sd, PCRESETSKILL_NONE); //Reset skills since we need to subtract more points.
if (sd->status.skill_point < level)
diff --git a/src/map/battle.c b/src/map/battle.c
index 879776871..0eda1f3e8 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6774,9 +6774,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if (
(s_sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE ||
(t_sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE ||
- (int)s_sd->status.base_level < battle_config.pk_min_level ||
- (int)t_sd->status.base_level < battle_config.pk_min_level ||
- (battle_config.pk_level_range && abs((int)s_sd->status.base_level - (int)t_sd->status.base_level) > battle_config.pk_level_range)
+ s_sd->status.base_level < battle_config.pk_min_level ||
+ t_sd->status.base_level < battle_config.pk_min_level ||
+ (battle_config.pk_level_range && abs(s_sd->status.base_level - t_sd->status.base_level) > battle_config.pk_level_range)
)
state &= ~BCT_ENEMY;
}
diff --git a/src/map/chat.c b/src/map/chat.c
index df48e1f2c..4429d125c 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -156,8 +156,8 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) {
return false;
}
- if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl ) {
- if(sd->status.base_level < cd->minLvl)
+ if (sd->status.base_level < (int)cd->minLvl || sd->status.base_level > (int)cd->maxLvl) { // FIXME
+ if(sd->status.base_level < (int)cd->minLvl) // FIXME
clif->joinchatfail(sd,5); // too low level
else
clif->joinchatfail(sd,6); // too high level
diff --git a/src/map/mob.c b/src/map/mob.c
index b6b36dd61..bede7deed 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2405,7 +2405,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.);
}
if (sd && battle_config.pk_mode &&
- (int)(md->level - sd->status.base_level) >= 20)
+ md->level - sd->status.base_level >= 20)
drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris]
// Increase drop rate if user has SC_CASH_RECEIVEITEM
diff --git a/src/map/pc.c b/src/map/pc.c
index 6be974e3b..32268dbe5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -960,11 +960,11 @@ int pc_isequip(struct map_session_data *sd,int n)
if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
return 1;
- if (item->elv && sd->status.base_level < (unsigned int)item->elv) {
+ if (item->elv && sd->status.base_level < item->elv) {
clif->msgtable(sd, MSG_ITEM_CANT_EQUIP_LVL);
return 0;
}
- if (item->elvmax && sd->status.base_level > (unsigned int)item->elvmax) {
+ if (item->elvmax && sd->status.base_level > item->elvmax) {
clif->msgtable(sd, MSG_ITEM_CANT_EQUIP_LVL);
return 0;
}
@@ -1583,7 +1583,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
break;
}
}
- if (sd->status.job_level < pc->skill_tree[c][i].joblv) {
+ if (sd->status.job_level < (int)pc->skill_tree[c][i].joblv) {
int jobid = pc->mapid2jobid(sd->class_, sd->status.sex); // need to get its own skilltree
if (jobid > -1) {
if (!pc->skill_tree[pc->class2idx(jobid)][i].inherited)
@@ -1687,7 +1687,7 @@ void pc_check_skilltree(struct map_session_data *sd, int skill_id)
if (!satisfied)
continue;
- if (sd->status.job_level < pc->skill_tree[c][i].joblv) {
+ if (sd->status.job_level < (int)pc->skill_tree[c][i].joblv) {
int jobid = pc->mapid2jobid(sd->class_, sd->status.sex); // need to get its own skilltree
if (jobid > -1) {
if (!pc->skill_tree[pc->class2idx(jobid)][i].inherited)
@@ -4878,12 +4878,12 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if(item->sex != 2 && sd->status.sex != item->sex)
return 0;
//Required level check
- if (item->elv && sd->status.base_level < (unsigned int)item->elv) {
+ if (item->elv && sd->status.base_level < item->elv) {
clif->msgtable(sd, MSG_ITEM_CANT_USE_LVL);
return 0;
}
- if (item->elvmax && sd->status.base_level > (unsigned int)item->elvmax) {
+ if (item->elvmax && sd->status.base_level > item->elvmax) {
clif->msgtable(sd, MSG_ITEM_CANT_USE_LVL);
return 0;
}
@@ -6579,7 +6579,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
sd->status.base_exp = next-1;
next = pc->gets_status_point(sd->status.base_level);
- sd->status.base_level ++;
+ sd->status.base_level++;
sd->status.status_point += next;
} while ((next=pc->nextbaseexp(sd)) > 0 && sd->status.base_exp >= next);
@@ -6621,7 +6621,7 @@ void pc_baselevelchanged(struct map_session_data *sd) {
nullpo_retv(sd);
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[i] >= 0 ) {
- if( sd->inventory_data[ sd->equip_index[i] ]->elvmax && sd->status.base_level > (unsigned int)sd->inventory_data[ sd->equip_index[i] ]->elvmax )
+ if (sd->inventory_data[sd->equip_index[i]]->elvmax != 0 && sd->status.base_level > sd->inventory_data[ sd->equip_index[i] ]->elvmax)
pc->unequipitem(sd, sd->equip_index[i], PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
}
}
@@ -6641,7 +6641,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
if(!battle_config.multi_level_up && sd->status.job_exp > next-1)
sd->status.job_exp = next-1;
- sd->status.job_level ++;
+ sd->status.job_level++;
sd->status.skill_point ++;
} while ((next=pc->nextjobexp(sd)) > 0 && sd->status.job_exp >= next);
@@ -6695,7 +6695,7 @@ void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned in
//PK modifier
/* this doesn't exist in Aegis, instead there's a CrazyKiller check which double all EXP from this point */
- if (battle_config.pk_mode && (int)(status->get_lv(src) - sd->status.base_level) >= 20)
+ if (battle_config.pk_mode && status->get_lv(src) - sd->status.base_level >= 20)
pk_ratio += 15; // pk_mode additional exp if monster >20 levels [Valaris]
@@ -6843,7 +6843,7 @@ unsigned int pc_nextbaseexp(const struct map_session_data *sd)
{
nullpo_ret(sd);
- if ((int)sd->status.base_level >= pc->maxbaselv(sd) || sd->status.base_level <= 0) // FIXME
+ if (sd->status.base_level >= pc->maxbaselv(sd) || sd->status.base_level <= 0)
return 0;
return pc->exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-1];
@@ -6852,7 +6852,7 @@ unsigned int pc_nextbaseexp(const struct map_session_data *sd)
//Base exp needed for this level.
unsigned int pc_thisbaseexp(const struct map_session_data *sd)
{
- if ((int)sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1) // FIXME
+ if (sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1)
return 0;
return pc->exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-2];
@@ -6870,7 +6870,7 @@ unsigned int pc_nextjobexp(const struct map_session_data *sd)
{
nullpo_ret(sd);
- if ((int)sd->status.job_level >= pc->maxjoblv(sd) || sd->status.job_level <= 0) // FIXME
+ if (sd->status.job_level >= pc->maxjoblv(sd) || sd->status.job_level <= 0)
return 0;
return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-1];
}
@@ -6878,7 +6878,7 @@ unsigned int pc_nextjobexp(const struct map_session_data *sd)
//Job exp needed for this level.
unsigned int pc_thisjobexp(const struct map_session_data *sd)
{
- if ((int)sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1) // FIXME
+ if (sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1)
return 0;
return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-2];
}
@@ -7293,7 +7293,7 @@ int pc_resetstate(struct map_session_data* sd)
// New statpoint table used here - Dexity
if (sd->status.base_level > MAX_LEVEL) {
//pc->statp[] goes out of bounds, can't reset!
- ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%u) is greater than the max level supported (%d)\n",
+ ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n",
sd->status.account_id, sd->status.char_id, sd->status.base_level, MAX_LEVEL);
return 0;
}
@@ -8144,13 +8144,13 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
case SP_BASELEVEL:
if (val > pc->maxbaselv(sd)) //Capping to max
val = pc->maxbaselv(sd);
- if ((unsigned int)val > sd->status.base_level) {
+ if (val > sd->status.base_level) {
int stat = 0, i;
- for (i = 0; i < (int)((unsigned int)val - sd->status.base_level); i++)
+ for (i = 0; i < val - sd->status.base_level; i++)
stat += pc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += stat;
}
- sd->status.base_level = (unsigned int)val;
+ sd->status.base_level = val;
sd->status.base_exp = 0;
// clif->updatestatus(sd, SP_BASELEVEL); // Gets updated at the bottom
clif->updatestatus(sd, SP_NEXTBASEEXP);
@@ -8163,13 +8163,13 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
}
break;
case SP_JOBLEVEL:
- if ((unsigned int)val >= sd->status.job_level) {
+ if (val >= sd->status.job_level) {
if (val > pc->maxjoblv(sd))
val = pc->maxjoblv(sd);
sd->status.skill_point += val - sd->status.job_level;
clif->updatestatus(sd, SP_SKILLPOINT);
}
- sd->status.job_level = (unsigned int)val;
+ sd->status.job_level = val;
sd->status.job_exp = 0;
// clif->updatestatus(sd, SP_JOBLEVEL); // Gets updated at the bottom
clif->updatestatus(sd, SP_NEXTJOBEXP);
@@ -8487,12 +8487,12 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
// changing from 1st to 2nd job
if ((b_class&JOBL_2) && !(sd->class_&JOBL_2) && (b_class&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) {
- sd->change_level_2nd = sd->status.job_level;
+ sd->change_level_2nd = sd->status.job_level; // FIXME
pc_setglobalreg (sd, script->add_str("jobchange_level"), sd->change_level_2nd);
}
// changing from 2nd to 3rd job
else if((b_class&JOBL_THIRD) && !(sd->class_&JOBL_THIRD)) {
- sd->change_level_3rd = sd->status.job_level;
+ sd->change_level_3rd = sd->status.job_level; // FIXME
pc_setglobalreg (sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
}
@@ -8544,8 +8544,8 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
sd->status.job_level=1;
sd->status.job_exp=0;
- if ((int)sd->status.base_level > pc->maxbaselv(sd)) { // FIXME
- sd->status.base_level = pc->maxbaselv(sd); // FIXME
+ if (sd->status.base_level > pc->maxbaselv(sd)) {
+ sd->status.base_level = pc->maxbaselv(sd);
sd->status.base_exp=0;
pc->resetstate(sd);
clif->updatestatus(sd,SP_STATUSPOINT);
diff --git a/src/map/skill.c b/src/map/skill.c
index 2962cb76e..0c2f099fb 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6891,7 +6891,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
return 1;
}
if( skill_id == AM_BERSERKPITCHER ) {
- if( dstsd && dstsd->status.base_level < (unsigned int)sd->inventory_data[i]->elv ) {
+ if (dstsd && dstsd->status.base_level < sd->inventory_data[i]->elv) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
map->freeblock_unlock();
return 1;
@@ -15322,7 +15322,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
if( sd->status.class_ == JOB_MECHANIC_T )
per += 100;
else
- per += 5 * ((signed int)sd->status.job_level - 50);
+ per += 5 * (sd->status.job_level - 50);
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_REFINE); // FIXME: is this the correct reason flag?
if (per > rnd() % 1000) {
diff --git a/src/map/status.c b/src/map/status.c
index 315f6bb19..3c3b15312 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2169,9 +2169,7 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt)
if (battle_config.pet_lv_rate && pd->msd) {
struct map_session_data *sd = pd->msd;
- int lv;
-
- lv =sd->status.base_level*battle_config.pet_lv_rate/100;
+ int lv = sd->status.base_level * battle_config.pet_lv_rate / 100;
if (lv < 0)
lv = 1;
if (lv != pd->pet.level || opt&SCO_FIRST) {
@@ -2630,7 +2628,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
// Job bonuses
index = pc->class2idx(sd->status.class_);
- for(i=0;i<(int)sd->status.job_level && i<MAX_LEVEL;i++){
+ for (i = 0; i < sd->status.job_level && i < MAX_LEVEL; i++) {
if(!status->dbs->job_bonus[index][i])
continue;
switch(status->dbs->job_bonus[index][i]) {