diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 22 | ||||
-rw-r--r-- | src/map/chrif.c | 10 | ||||
-rw-r--r-- | src/map/pc.c | 38 |
3 files changed, 19 insertions, 51 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7139c6935..4c8766a4c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1739,10 +1739,7 @@ int atcommand_baselevelup(const int fd, struct map_session_data* sd, const char* for (i = 1; i <= level; i++) status_point += (sd->status.base_level + i + 14) / 5; - if (sd->status.status_point > USHRT_MAX - status_point) - sd->status.status_point = USHRT_MAX; - else - sd->status.status_point += status_point; + sd->status.status_point += status_point; sd->status.base_level += (unsigned int)level; status_percent_heal(&sd->bl, 100, 100); clif_misceffect(&sd->bl, 0); @@ -1799,10 +1796,7 @@ int atcommand_joblevelup(const int fd, struct map_session_data* sd, const char* sd->status.job_level += (unsigned int)level; clif_updatestatus(sd, SP_JOBLEVEL); clif_updatestatus(sd, SP_NEXTJOBEXP); - if (sd->status.skill_point > USHRT_MAX - level) - sd->status.skill_point = USHRT_MAX; - else - sd->status.skill_point += level; + sd->status.skill_point += level; clif_updatestatus(sd, SP_SKILLPOINT); status_calc_pc(sd, 0); clif_misceffect(&sd->bl, 1); @@ -2848,15 +2842,13 @@ int atcommand_statuspoint(const int fd, struct map_session_data* sd, const char* return -1; } - if (point > 0 && sd->status.status_point > USHRT_MAX - point) - new_status_point = USHRT_MAX; - else if (point < 0 && sd->status.status_point < -point) new_status_point = 0; else new_status_point = sd->status.status_point + point; + if (new_status_point != (int)sd->status.status_point) { - sd->status.status_point = (unsigned short)new_status_point; + sd->status.status_point = new_status_point; clif_updatestatus(sd, SP_STATUSPOINT); clif_displaymessage(fd, msg_txt(174)); // Number of status points changed. } else { @@ -2883,15 +2875,13 @@ int atcommand_skillpoint(const int fd, struct map_session_data* sd, const char* return -1; } - if (point > 0 && sd->status.skill_point > USHRT_MAX - point) - new_skill_point = USHRT_MAX; - else if (point < 0 && sd->status.skill_point < -point) + if (point < 0 && sd->status.skill_point < -point) new_skill_point = 0; else new_skill_point = sd->status.skill_point + point; if (new_skill_point != (int)sd->status.skill_point) { - sd->status.skill_point = (unsigned short)new_skill_point; + sd->status.skill_point = new_skill_point; clif_updatestatus(sd, SP_SKILLPOINT); clif_displaymessage(fd, msg_txt(175)); // Number of skill points changed. } else { diff --git a/src/map/chrif.c b/src/map/chrif.c index 089d70492..71324f02a 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -837,10 +837,7 @@ int chrif_changedsex(int fd) // remove specifical skills of Bard classes for(i = 315; i <= 322; i++) { if (sd->status.skill[i].id > 0 && !sd->status.skill[i].flag) { - if (sd->status.skill_point > USHRT_MAX - sd->status.skill[i].lv) - sd->status.skill_point = USHRT_MAX; - else - sd->status.skill_point += sd->status.skill[i].lv; + sd->status.skill_point += sd->status.skill[i].lv; sd->status.skill[i].id = 0; sd->status.skill[i].lv = 0; } @@ -848,10 +845,7 @@ int chrif_changedsex(int fd) // remove specifical skills of Dancer classes for(i = 323; i <= 330; i++) { if (sd->status.skill[i].id > 0 && !sd->status.skill[i].flag) { - if (sd->status.skill_point > USHRT_MAX - sd->status.skill[i].lv) - sd->status.skill_point = USHRT_MAX; - else - sd->status.skill_point += sd->status.skill[i].lv; + sd->status.skill_point += sd->status.skill[i].lv; sd->status.skill[i].id = 0; sd->status.skill[i].lv = 0; } diff --git a/src/map/pc.c b/src/map/pc.c index a5ce1d6b5..a4ed7a62e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1308,7 +1308,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) else //Do not send S. Novices to first class (Novice) if ((sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE && - sd->status.skill_point >= (int)sd->status.job_level && + sd->status.skill_point >= sd->status.job_level && ((sd->change_level > 0 && skill_point < sd->change_level+8) || skill_point < 58)) { //Send it to first class. c &= MAPID_BASEMASK; @@ -4391,10 +4391,8 @@ int pc_checkbaselevelup(struct map_session_data *sd) next = statp[sd->status.base_level] - statp[sd->status.base_level-1]; else //Estimated way. next = (sd->status.base_level+14) / 5 ; - if (sd->status.status_point > USHRT_MAX - next) - sd->status.status_point = USHRT_MAX; - else - sd->status.status_point += next; + + sd->status.status_point += next; } while ((next=pc_nextbaseexp(sd)) > 0 && sd->status.base_exp >= next); @@ -4943,11 +4941,10 @@ int pc_resetstate(struct map_session_data* sd) if (sd->class_&JOBL_UPPER) stat+=52; // extra 52+48=100 stat points - if (stat > USHRT_MAX) - sd->status.status_point = USHRT_MAX; - else - sd->status.status_point = stat; - } else { //Use new stat-calculating equation [Skotlex] + sd->status.status_point = stat; + } + else + { //Use new stat-calculating equation [Skotlex] #define sumsp(a) (((a-1)/10 +2)*(5*((a-1)/10 +1) + (a-1)%10) -10) int add=0; add += sumsp(sd->status.str); @@ -4956,10 +4953,7 @@ int pc_resetstate(struct map_session_data* sd) add += sumsp(sd->status.int_); add += sumsp(sd->status.dex); add += sumsp(sd->status.luk); - if (add > USHRT_MAX - sd->status.status_point) - sd->status.status_point = USHRT_MAX; - else - sd->status.status_point+=add; + sd->status.status_point+=add; } sd->status.str=1; @@ -5059,10 +5053,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( flag&2 || !skill_point ) return skill_point; - if( sd->status.skill_point > USHRT_MAX - skill_point ) - sd->status.skill_point = USHRT_MAX; - else - sd->status.skill_point += skill_point; + sd->status.skill_point += skill_point; if( flag&1 ) { @@ -5545,11 +5536,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val) int stat=0; for (i = 1; i <= (int)((unsigned int)val - sd->status.base_level); i++) stat += (sd->status.base_level + i + 14) / 5 ; - if (sd->status.status_point > USHRT_MAX - stat) - - sd->status.status_point = USHRT_MAX; - else - sd->status.status_point += stat; + sd->status.status_point += stat; } sd->status.base_level = (unsigned int)val; sd->status.base_exp = 0; @@ -5562,10 +5549,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val) case SP_JOBLEVEL: if ((unsigned int)val >= sd->status.job_level) { if ((unsigned int)val > pc_maxjoblv(sd)) val = pc_maxjoblv(sd); - if (sd->status.skill_point > USHRT_MAX - val + sd->status.job_level) - sd->status.skill_point = USHRT_MAX; - else - sd->status.skill_point += val-sd->status.job_level; + sd->status.skill_point += val - sd->status.job_level; clif_updatestatus(sd, SP_SKILLPOINT); } sd->status.job_level = (unsigned int)val; |