summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-07-14 03:41:02 +0200
committerHaru <haru@dotalux.com>2016-07-14 03:41:02 +0200
commitf4aee10c1ae44e220e9e84ae47180758a4a77f4d (patch)
treec77569b11b8bb6321decac0331213a943fe4323a /src
parent7bcb379c83327331bda05a23000dc0a6bbbefa48 (diff)
downloadhercules-f4aee10c1ae44e220e9e84ae47180758a4a77f4d.tar.gz
hercules-f4aee10c1ae44e220e9e84ae47180758a4a77f4d.tar.bz2
hercules-f4aee10c1ae44e220e9e84ae47180758a4a77f4d.tar.xz
hercules-f4aee10c1ae44e220e9e84ae47180758a4a77f4d.zip
Changed map_session_data::change_level_2nd and map_session_data::change_level_3rd to int
Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c5
-rw-r--r--src/map/pc.c41
-rw-r--r--src/map/pc.h6
3 files changed, 25 insertions, 27 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a0ecef9af..969f564ba 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9295,8 +9295,9 @@ ACMD(costume){
}
/* for debugging purposes (so users can easily provide us with debug info) */
/* should be trashed as soon as its no longer necessary */
-ACMD(skdebug) {
- safesnprintf(atcmd_output, sizeof(atcmd_output),"second: %u; third: %u", sd->sktree.second, sd->sktree.third);
+ACMD(skdebug)
+{
+ safesnprintf(atcmd_output, sizeof(atcmd_output),"second: %d; third: %d", sd->sktree.second, sd->sktree.third);
clif->message(fd,atcmd_output);
safesnprintf(atcmd_output, sizeof(atcmd_output),"pc_calc_skilltree_normalize_job: %d",pc->calc_skilltree_normalize_job(sd));
clif->message(fd,atcmd_output);
diff --git a/src/map/pc.c b/src/map/pc.c
index 32268dbe5..29eb5e45e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1756,28 +1756,25 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
else if ((sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE)
{
// regenerate change_level_2nd
- if (!sd->change_level_2nd)
- {
- if (sd->class_&JOBL_THIRD)
- {
+ if (sd->change_level_2nd == 0) {
+ if (sd->class_&JOBL_THIRD) {
// if neither 2nd nor 3rd jobchange levels are known, we have to assume a default for 2nd
- if (!sd->change_level_3rd)
- sd->change_level_2nd = pc->max_level[pc->class2idx(pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1]; // FIXME
- else
- sd->change_level_2nd = 1 + skill_point + sd->status.skill_point
+ if (sd->change_level_3rd == 0) {
+ sd->change_level_2nd = pc->max_level[pc->class2idx(pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1];
+ } else {
+ sd->change_level_2nd = 1 + skill_point + (int)sd->status.skill_point // FIXME
- (sd->status.job_level - 1)
- (sd->change_level_3rd - 1)
- novice_skills;
- }
- else
- {
- sd->change_level_2nd = 1 + skill_point + sd->status.skill_point
+ }
+ } else {
+ sd->change_level_2nd = 1 + skill_point + (int)sd->status.skill_point // FIXME
- (sd->status.job_level - 1)
- novice_skills;
}
- pc_setglobalreg (sd, script->add_str("jobchange_level"), sd->change_level_2nd);
+ pc_setglobalreg(sd, script->add_str("jobchange_level"), sd->change_level_2nd);
}
if (skill_point < novice_skills + (sd->change_level_2nd - 1)) {
@@ -1785,12 +1782,12 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
sd->sktree.second = ( novice_skills + (sd->change_level_2nd - 1) ) - skill_point;
} else if(sd->class_&JOBL_THIRD) { // limit 3rd class to 2nd class/trans job levels
// regenerate change_level_3rd
- if (!sd->change_level_3rd) {
- sd->change_level_3rd = 1 + skill_point + sd->status.skill_point
+ if (sd->change_level_3rd == 0) {
+ sd->change_level_3rd = 1 + skill_point + (int)sd->status.skill_point // FIXME
- (sd->status.job_level - 1)
- (sd->change_level_2nd - 1)
- novice_skills;
- pc_setglobalreg (sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
+ pc_setglobalreg(sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
}
if (skill_point < novice_skills + (sd->change_level_2nd - 1) + (sd->change_level_3rd - 1)) {
@@ -7129,9 +7126,9 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
if (!pc_has_permission(sd, PC_PERM_ALL_SKILL)) // may skill everything at any time anyways, and this would cause a huge slowdown
clif->skillinfoblock(sd);
} else if( battle_config.skillup_limit ){
- if (sd->sktree.second)
+ if (sd->sktree.second != 0)
clif->msgtable_num(sd, MSG_SKILL_POINTS_LEFT_JOB1, sd->sktree.second);
- else if (sd->sktree.third)
+ else if (sd->sktree.third != 0)
clif->msgtable_num(sd, MSG_SKILL_POINTS_LEFT_JOB2, sd->sktree.third);
else if (pc->calc_skillpoint(sd) < 9) /* TODO: official response? */
clif->messagecolor_self(sd->fd, COLOR_RED, "You need the basic skills");
@@ -8487,13 +8484,13 @@ 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; // FIXME
- pc_setglobalreg (sd, script->add_str("jobchange_level"), sd->change_level_2nd);
+ sd->change_level_2nd = sd->status.job_level;
+ 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; // FIXME
- pc_setglobalreg (sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
+ sd->change_level_3rd = sd->status.job_level;
+ pc_setglobalreg(sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
}
if(sd->cloneskill_id) {
diff --git a/src/map/pc.h b/src/map/pc.h
index a3a7b780d..df5416bc1 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -456,8 +456,8 @@ END_ZEROED_BLOCK;
int eventtimer[MAX_EVENTTIMER];
unsigned short eventcount; // [celest]
- unsigned char change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value]
- unsigned char change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value]
+ int change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value]
+ int change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value]
char fakename[NAME_LENGTH]; // fake names [Valaris]
@@ -564,7 +564,7 @@ END_ZEROED_BLOCK;
/* */
struct {
- unsigned int second,third;
+ int second, third;
} sktree;
/**