summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index bef4f0c31..8e4a16901 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1141,8 +1141,6 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
struct guild *g;
struct guild_expcache *c;
int per;
- unsigned int exp2;
- double tmp;
nullpo_retr(0, sd);
@@ -1150,32 +1148,23 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
if (sd->status.guild_id == 0 ||
(g = guild_search(sd->status.guild_id)) == NULL ||
- (per = g->position[guild_getposition(sd,g)].exp_mode) <= 0)
+ (per = guild_getposition(sd,g)) < 0 ||
+ (per = g->position[per].exp_mode) < 1)
return 0;
- if (per > 100) per = 100;
- else
- if (per < 1) return 0;
-
-
- tmp = exp * per / 100;
- if (tmp <= 0)
- return 0;
-
- exp2 = (unsigned int)tmp;
+ if (per < 100)
+ exp = (unsigned int) exp * per / 100;
+ //Otherwise tax everything.
- if (battle_config.guild_exp_rate != 100)
- tmp = tmp*battle_config.guild_exp_rate/100;
-
c = guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
- if (c->exp > UINT_MAX - (unsigned int)tmp)
+ if (c->exp > UINT_MAX - exp)
c->exp = UINT_MAX;
else
- c->exp += (unsigned int)tmp;
+ c->exp += exp;
- return exp2;
+ return exp;
}
// Celest