summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-07-14 02:29:05 +0200
committerHaru <haru@dotalux.com>2016-07-14 02:32:46 +0200
commita7c3d70ae42370b570bf25972089f2326ace6396 (patch)
treeafdd60ab8a097d30071239a685ae148aed15b693 /src
parent5d1a002d3b10e7e833790d85aad727a30fd5703c (diff)
downloadhercules-a7c3d70ae42370b570bf25972089f2326ace6396.tar.gz
hercules-a7c3d70ae42370b570bf25972089f2326ace6396.tar.bz2
hercules-a7c3d70ae42370b570bf25972089f2326ace6396.tar.xz
hercules-a7c3d70ae42370b570bf25972089f2326ace6396.zip
Changed pc->maxbaselv() and pc->maxjoblv() to return signed int and take const sd
Removes some FIXME (and continues a chain reaction) Fixes some of the many -Wsign-compare warnings Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c10
-rw-r--r--src/map/pc.c23
-rw-r--r--src/map/pc.h4
3 files changed, 19 insertions, 18 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index eef67189a..18ea6cc01 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1364,12 +1364,12 @@ ACMD(baselevelup)
}
if (level > 0) {
- if (sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris
+ if ((int)sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris // FIXME
clif->message(fd, msg_fd(fd,47)); // Base level can't go any higher.
return false;
} // End Addition
- if ((unsigned int)level > pc->maxbaselv(sd) || (unsigned int)level > pc->maxbaselv(sd) - sd->status.base_level) // fix positive overflow
- level = pc->maxbaselv(sd) - sd->status.base_level;
+ 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
for (i = 0; i < level; i++)
status_point += pc->gets_status_point(sd->status.base_level + i);
@@ -1422,11 +1422,11 @@ ACMD(joblevelup)
return false;
}
if (level > 0) {
- if (sd->status.job_level >= pc->maxjoblv(sd)) {
+ if ((int)sd->status.job_level >= pc->maxjoblv(sd)) { // FIXME
clif->message(fd, msg_fd(fd,23)); // Job level can't go any higher.
return false;
}
- if ((unsigned int)level > pc->maxjoblv(sd) || (unsigned int)level > pc->maxjoblv(sd) - sd->status.job_level) // fix positive overflow
+ if (level > pc->maxjoblv(sd) || level > pc->maxjoblv(sd) - (int)sd->status.job_level) // fix positive overflow // FIXME
level = pc->maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += (unsigned int)level;
sd->status.skill_point += level;
diff --git a/src/map/pc.c b/src/map/pc.c
index a3c7acb14..c0f4d47ef 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6824,12 +6824,12 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in
/*==========================================
* Returns max level for this character.
*------------------------------------------*/
-unsigned int pc_maxbaselv(struct map_session_data *sd) // FIXME
+int pc_maxbaselv(const struct map_session_data *sd)
{
return pc->max_level[pc->class2idx(sd->status.class_)][0];
}
-unsigned int pc_maxjoblv(struct map_session_data *sd) // FIXME
+int pc_maxjoblv(const struct map_session_data *sd)
{
return pc->max_level[pc->class2idx(sd->status.class_)][1];
}
@@ -6843,7 +6843,7 @@ unsigned int pc_nextbaseexp(struct map_session_data *sd)
{
nullpo_ret(sd);
- if(sd->status.base_level>=pc->maxbaselv(sd) || sd->status.base_level<=0)
+ if ((int)sd->status.base_level >= pc->maxbaselv(sd) || sd->status.base_level <= 0) // FIXME
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(struct map_session_data *sd)
//Base exp needed for this level.
unsigned int pc_thisbaseexp(struct map_session_data *sd)
{
- if(sd->status.base_level>pc->maxbaselv(sd) || sd->status.base_level<=1)
+ if ((int)sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1) // FIXME
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(struct map_session_data *sd)
{
nullpo_ret(sd);
- if(sd->status.job_level>=pc->maxjoblv(sd) || sd->status.job_level<=0)
+ if ((int)sd->status.job_level >= pc->maxjoblv(sd) || sd->status.job_level <= 0) // FIXME
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(struct map_session_data *sd)
//Job exp needed for this level.
unsigned int pc_thisjobexp(struct map_session_data *sd)
{
- if(sd->status.job_level>pc->maxjoblv(sd) || sd->status.job_level<=1)
+ if ((int)sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1) // FIXME
return 0;
return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-2];
}
@@ -7717,7 +7717,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
if (md->target_id==sd->bl.id)
mob->unlocktarget(md,tick);
if (battle_config.mobs_level_up && md->status.hp
- && (unsigned int)md->level < pc->maxbaselv(sd)
+ && md->level < pc->maxbaselv(sd)
&& !md->guardian_data && md->special_state.ai == AI_NONE// Guardians/summons should not level. [Skotlex]
) {
// monster level up [Valaris]
@@ -8142,7 +8142,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
switch(type){
case SP_BASELEVEL:
- if ((unsigned int)val > pc->maxbaselv(sd)) //Capping to max
+ if (val > pc->maxbaselv(sd)) //Capping to max
val = pc->maxbaselv(sd);
if ((unsigned int)val > sd->status.base_level) {
int stat = 0, i;
@@ -8164,7 +8164,8 @@ 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 ((unsigned int)val > pc->maxjoblv(sd)) val = pc->maxjoblv(sd);
+ if (val > pc->maxjoblv(sd))
+ val = pc->maxjoblv(sd);
sd->status.skill_point += val - sd->status.job_level;
clif->updatestatus(sd, SP_SKILLPOINT);
}
@@ -8543,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 (sd->status.base_level > pc->maxbaselv(sd)) {
- sd->status.base_level = pc->maxbaselv(sd);
+ if ((int)sd->status.base_level > pc->maxbaselv(sd)) { // FIXME
+ sd->status.base_level = pc->maxbaselv(sd); // FIXME
sd->status.base_exp=0;
pc->resetstate(sd);
clif->updatestatus(sd,SP_STATUSPOINT);
diff --git a/src/map/pc.h b/src/map/pc.h
index 8b1c9a34d..f3b2c1ff6 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -909,8 +909,8 @@ END_ZEROED_BLOCK; /* End */
int (*follow) (struct map_session_data *sd, int target_id); // [MouseJstr]
int (*stop_following) (struct map_session_data *sd);
- unsigned int (*maxbaselv) (struct map_session_data *sd);
- unsigned int (*maxjoblv) (struct map_session_data *sd);
+ int (*maxbaselv) (const struct map_session_data *sd);
+ int (*maxjoblv) (const struct map_session_data *sd);
int (*checkbaselevelup) (struct map_session_data *sd);
int (*checkjoblevelup) (struct map_session_data *sd);
bool (*gainexp) (struct map_session_data *sd, struct block_list *src, unsigned int base_exp, unsigned int job_exp, bool is_quest);