summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-13 15:56:22 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-13 15:56:22 +0000
commit73ad36cce173502c226edc839ef06c3fe9f90853 (patch)
treec92e383c11e7d5efcca16226b01afa640216ae69 /src/map/atcommand.c
parent74ae20b906cbdf6b0c17afa6d9911e5c3e58f161 (diff)
downloadhercules-73ad36cce173502c226edc839ef06c3fe9f90853.tar.gz
hercules-73ad36cce173502c226edc839ef06c3fe9f90853.tar.bz2
hercules-73ad36cce173502c226edc839ef06c3fe9f90853.tar.xz
hercules-73ad36cce173502c226edc839ef06c3fe9f90853.zip
- Fixed crash when looking for SC_MIRACLE in battle_calc_weapon_attack
- Some more standard C code cleanups. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6038 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e62c9a71a..2501e633c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -4138,7 +4138,7 @@ int atcommand_param(
int index, value = 0, new_value, max;
const char* param[] = { "@str", "@agi", "@vit", "@int", "@dex", "@luk", NULL };
short* status[6];
- //We don't use direct initialization because it isn't part of the C standard.
+ //we don't use direct initialization because it isn't part of the c standard.
nullpo_retr(-1, sd);
status[0] = &sd->status.str;
@@ -4167,18 +4167,15 @@ int atcommand_param(
clif_displaymessage(fd, atcmd_output);
return -1;
}
- if (value >0) {
- max = pc_maxparameter(sd);
- if (*status[index] > max - value)
- new_value = max;
- else
- new_value = *status[index] + value;
- } else {
- if (*status[index] <= -value)
- new_value = 1;
- else
- new_value = *status[index] + value;
- }
+
+ max = pc_maxparameter(sd);
+ if (value > 0 && *status[index] > max - value)
+ new_value = max;
+ else if (value < 0 && *status[index] <= -value)
+ new_value = 1;
+ else
+ new_value = *status[index] + value;
+
if (new_value != (int)*status[index]) {
*status[index] = new_value;
clif_updatestatus(sd, SP_STR + index);
@@ -4206,11 +4203,16 @@ int atcommand_stat_all(
const char* command, const char* message)
{
int index, count, value = 0, max, new_value;
- short* status[] = {
- &sd->status.str, &sd->status.agi, &sd->status.vit,
- &sd->status.int_, &sd->status.dex, &sd->status.luk
- };
+ short* status[6];
+ //we don't use direct initialization because it isn't part of the c standard.
nullpo_retr(-1, sd);
+
+ status[0] = &sd->status.str;
+ status[1] = &sd->status.agi;
+ status[2] = &sd->status.vit;
+ status[3] = &sd->status.int_;
+ status[4] = &sd->status.dex;
+ status[5] = &sd->status.luk;
if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0)
value = pc_maxparameter(sd);