diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-09 14:21:41 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-09 14:21:41 +0000 |
commit | 173c3195ade5a6cdfe20c49e7f184a6b1336ca19 (patch) | |
tree | f85048abbba257b7418b8f379ed2b858088945d7 /src/map/party.c | |
parent | 71ae3526c038b1aceb0400c6c798f2a69234087b (diff) | |
download | hercules-173c3195ade5a6cdfe20c49e7f184a6b1336ca19.tar.gz hercules-173c3195ade5a6cdfe20c49e7f184a6b1336ca19.tar.bz2 hercules-173c3195ade5a6cdfe20c49e7f184a6b1336ca19.tar.xz hercules-173c3195ade5a6cdfe20c49e7f184a6b1336ca19.zip |
- Code rewrites in mob_damage and party_exp_even_share for correctly handling overflow issues. Now uses UINT_MAX for range comparisons, as it should be.
- Also modified the mob_db reading to use UINT_MAX for exp limits, changed their exp/job exp fields to unsigned int as well.
- Modified multi_level_up behaviour to work as specified by Kyoki.
- removed functions pc_next[base/job]after as they are no longer needed.
- Modified the skill attack display of Meteor Assault and the Warm Skills (I think the caster should no longer do fancy animations now on each hit)
- Added back water elemental targets being inmune to SC_FREEZE
- Fixed the status_change_start line in charsave.c (I knew I was forgetting something)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5235 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/party.c')
-rw-r--r-- | src/map/party.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/map/party.c b/src/map/party.c index d5c6b800b..be8520d8f 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -4,6 +4,7 @@ #include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "../common/timer.h"
#include "../common/socket.h"
@@ -639,12 +640,11 @@ int party_send_xy_clear(struct party *p) }
// exp share and added zeny share [Valaris]
-int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny)
+int party_exp_share(struct party *p,int map,unsigned int base_exp,unsigned int job_exp,int zeny)
{
struct map_session_data* sd[MAX_PARTY];
int i;
short c, bonus =100; // modified [Valaris]
- unsigned long base, job;
nullpo_retr(0, p);
@@ -660,15 +660,22 @@ int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny) bonus += (battle_config.party_even_share_bonus*c*(c-1)/10); //Changed Valaris's bonus switch to an equation [Skotlex]
else //Official kRO/iRO sites state that the even share bonus is 10% per additional party member.
bonus += (c-1)*10;
- base = (unsigned long)(base_exp/c)*bonus/100;
- job = (unsigned long)(job_exp/c)*bonus/100;
- if (base > 0x7fffffff)
- base = 0x7fffffff;
- if (job > 0x7fffffff)
- job = 0x7fffffff;
+
+ base_exp/=c;
+ job_exp/=c;
+ if (base_exp/100 > UINT_MAX/bonus)
+ base_exp= UINT_MAX; //Exp overflow
+ else
+ base_exp = base_exp*bonus/100;
+
+ if (job_exp/100 > UINT_MAX/bonus)
+ job_exp = UINT_MAX;
+ else
+ job_exp = job_exp*bonus/100;
+
for (i = 0; i < c; i++)
{
- pc_gainexp(sd[i], base, job);
+ pc_gainexp(sd[i], base_exp, job_exp);
if (battle_config.zeny_from_mobs) // zeny from mobs [Valaris]
pc_getzeny(sd[i],bonus*zeny/(c*100));
}
|