From bba15f5d17900a5e9cb85c796555f8ed1591ea2a Mon Sep 17 00:00:00 2001 From: ultramage Date: Fri, 27 Jul 2007 19:06:40 +0000 Subject: * 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 --- src/map/pc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/map/pc.c') 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; } -- cgit v1.2.3-70-g09d2