summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c15
-rw-r--r--src/char_sql/char.c8
-rw-r--r--src/common/mmo.h2
-rw-r--r--src/map/atcommand.c22
-rw-r--r--src/map/chrif.c10
-rw-r--r--src/map/pc.c38
6 files changed, 28 insertions, 67 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 3d9df5752..526a4e78c 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -675,8 +675,8 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg
p->int_ = tmp_int[16];
p->dex = tmp_int[17];
p->luk = tmp_int[18];
- p->status_point = min(tmp_int[19], USHRT_MAX);
- p->skill_point = min(tmp_int[20], USHRT_MAX);
+ p->status_point = tmp_int[19];
+ p->skill_point = tmp_int[20];
p->option = tmp_int[21];
p->karma = tmp_int[22];
p->manner = tmp_int[23];
@@ -2077,10 +2077,7 @@ int parse_fromlogin(int fd)
// remove specifical skills of classes 19, 4020 and 4042
for(j = 315; j <= 322; j++) {
if (char_dat[i].status.skill[j].id > 0 && !char_dat[i].status.skill[j].flag) {
- if (char_dat[i].status.skill_point > USHRT_MAX - char_dat[i].status.skill[j].lv)
- char_dat[i].status.skill_point = USHRT_MAX;
- else
- char_dat[i].status.skill_point += char_dat[i].status.skill[j].lv;
+ char_dat[i].status.skill_point += char_dat[i].status.skill[j].lv;
char_dat[i].status.skill[j].id = 0;
char_dat[i].status.skill[j].lv = 0;
}
@@ -2088,11 +2085,7 @@ int parse_fromlogin(int fd)
// remove specifical skills of classes 20, 4021 and 4043
for(j = 323; j <= 330; j++) {
if (char_dat[i].status.skill[j].id > 0 && !char_dat[i].status.skill[j].flag) {
- if (char_dat[i].status.skill_point > USHRT_MAX - char_dat[i].status.skill[j].lv)
- char_dat[i].status.skill_point = USHRT_MAX;
- else
- char_dat[i].status.skill_point += char_dat[i].status.skill[j].lv;
-
+ char_dat[i].status.skill_point += char_dat[i].status.skill[j].lv;
char_dat[i].status.skill[j].id = 0;
char_dat[i].status.skill[j].lv = 0;
}
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 9a03612d4..40fe2acee 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -858,8 +858,8 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_USHORT, &p.status_point, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_USHORT, &p.skill_point, 0, NULL, NULL)
+ || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, NULL, NULL)
+ || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, NULL, NULL)
@@ -950,8 +950,8 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_USHORT, &p->status_point, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_USHORT, &p->skill_point, 0, NULL, NULL)
+ || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, NULL, NULL)
+ || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, NULL, NULL)
diff --git a/src/common/mmo.h b/src/common/mmo.h
index e138244bd..cb3f2b934 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -270,7 +270,7 @@ struct mmo_charstatus {
int zeny;
short class_;
- unsigned short status_point,skill_point;
+ unsigned int status_point,skill_point;
int hp,max_hp,sp,max_sp;
unsigned int option;
short manner;
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;