summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-07-27 19:06:40 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-07-27 19:06:40 +0000
commitbba15f5d17900a5e9cb85c796555f8ed1591ea2a (patch)
tree37842cee4078170b560984ffb540a1ec329e1419 /src/map/pc.c
parente82df73e8a0d6c1757ef10a8532545ab0cd80ac4 (diff)
downloadhercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.tar.gz
hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.tar.bz2
hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.tar.xz
hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.zip
* Simplified exp gain equations (now more FPU-friendly and precise), also fixes the uninitialized variable problem
* Corrected one exp calculation overflow (mainly affected high-rate pk servers) * Fixed Neuralizer item script typo git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10921 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 49d880767..ad57ef809 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4230,17 +4230,8 @@ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsi
if (!bonus)
return;
- temp = *base_exp*bonus/100;
- if (*base_exp > UINT_MAX - temp)
- *base_exp = UINT_MAX;
- else
- *base_exp += temp;
-
- temp = *job_exp*bonus/100;
- if (*job_exp > UINT_MAX - temp)
- *job_exp = UINT_MAX;
- else
- *job_exp += temp;
+ *base_exp += (unsigned int) cap_value((double)*base_exp * bonus/100., 1, UINT_MAX);
+ *job_exp += (unsigned int) cap_value((double)*job_exp * bonus/100., 1, UINT_MAX);
return;
}