summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-07-14 04:11:27 +0200
committerHaru <haru@dotalux.com>2016-07-14 04:11:27 +0200
commit6c0b298c869913105e4c4d29a6580bf68cd89f55 (patch)
tree608154d6fb2e2a220249fd711c6e23fa8cb98937 /src/map/atcommand.c
parentd85daf0f76485c8a3f065d79fb23dc3566aa81cd (diff)
downloadhercules-6c0b298c869913105e4c4d29a6580bf68cd89f55.tar.gz
hercules-6c0b298c869913105e4c4d29a6580bf68cd89f55.tar.bz2
hercules-6c0b298c869913105e4c4d29a6580bf68cd89f55.tar.xz
hercules-6c0b298c869913105e4c4d29a6580bf68cd89f55.zip
Changed mmo_charstatus::status_point and mmo_charstatus::skill_point to int
Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 969f564ba..66ccbe3b0 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2296,30 +2296,18 @@ ACMD(displaystatus)
ACMD(statuspoint)
{
int point;
- unsigned int new_status_point;
+ int new_status_point;
if (!*message || (point = atoi(message)) == 0) {
clif->message(fd, msg_fd(fd,1010)); // Please enter a number (usage: @stpoint <number of points>).
return false;
}
- if(point < 0)
- {
- if(sd->status.status_point < (unsigned int)(-point))
- {
- new_status_point = 0;
- }
- else
- {
- new_status_point = sd->status.status_point + point;
- }
- }
- else if(UINT_MAX - sd->status.status_point < (unsigned int)point)
- {
- new_status_point = UINT_MAX;
- }
- else
- {
+ if (point < 0 && sd->status.status_point + point < 0) {
+ new_status_point = 0;
+ } else if (point > 0 && (int64)sd->status.status_point + point > INT_MAX) {
+ new_status_point = INT_MAX;
+ } else {
new_status_point = sd->status.status_point + point;
}
@@ -2344,30 +2332,18 @@ ACMD(statuspoint)
ACMD(skillpoint)
{
int point;
- unsigned int new_skill_point;
+ int new_skill_point;
if (!*message || (point = atoi(message)) == 0) {
clif->message(fd, msg_fd(fd,1011)); // Please enter a number (usage: @skpoint <number of points>).
return false;
}
- if(point < 0)
- {
- if(sd->status.skill_point < (unsigned int)(-point))
- {
- new_skill_point = 0;
- }
- else
- {
- new_skill_point = sd->status.skill_point + point;
- }
- }
- else if(UINT_MAX - sd->status.skill_point < (unsigned int)point)
- {
- new_skill_point = UINT_MAX;
- }
- else
- {
+ if (point < 0 && sd->status.skill_point + point < 0) {
+ new_skill_point = 0;
+ } else if (point > 0 && (int64)sd->status.skill_point + point > INT_MAX) {
+ new_skill_point = INT_MAX;
+ } else {
new_skill_point = sd->status.skill_point + point;
}