summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-18 14:14:33 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-18 14:14:33 +0000
commit80342514a6d3370029d6017428afdacce220fc17 (patch)
treecedd055deb2867d4958a27bfba80a2ddea50bddb /src/map/npc.c
parent8192b22f355b8e0bce5a49bf0ddaeaf754f1682d (diff)
downloadhercules-80342514a6d3370029d6017428afdacce220fc17.tar.gz
hercules-80342514a6d3370029d6017428afdacce220fc17.tar.bz2
hercules-80342514a6d3370029d6017428afdacce220fc17.tar.xz
hercules-80342514a6d3370029d6017428afdacce220fc17.zip
- Fixed overflow on the mob delay adjustment setting.
- Fixed characters being unable to trade again if you attempt a trade on someone who is on storage/npc when you accept the trade. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9669 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 4b1fa5c10..90d61e226 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2281,20 +2281,21 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
mode = mob_db(class_)->status.mode;
if (mode & MD_BOSS) { //Bosses
if (battle_config.boss_spawn_delay != 100)
- {
- mob.delay1 = mob.delay1*battle_config.boss_spawn_delay/100;
- mob.delay2 = mob.delay2*battle_config.boss_spawn_delay/100;
+ { // Divide by 100 first to prevent overflows
+ //(precision loss is minimal as duration is in ms already)
+ mob.delay1 = mob.delay1/100*battle_config.boss_spawn_delay;
+ mob.delay2 = mob.delay2/100*battle_config.boss_spawn_delay;
}
} else if (mode&MD_PLANT) { //Plants
if (battle_config.plant_spawn_delay != 100)
{
- mob.delay1 = mob.delay1*battle_config.plant_spawn_delay/100;
- mob.delay2 = mob.delay2*battle_config.plant_spawn_delay/100;
+ mob.delay1 = mob.delay1/100*battle_config.plant_spawn_delay;
+ mob.delay2 = mob.delay2/100*battle_config.plant_spawn_delay;
}
} else if (battle_config.mob_spawn_delay != 100)
{ //Normal mobs
- mob.delay1 = mob.delay1*battle_config.mob_spawn_delay/100;
- mob.delay2 = mob.delay2*battle_config.mob_spawn_delay/100;
+ mob.delay1 = mob.delay1/100*battle_config.mob_spawn_delay;
+ mob.delay2 = mob.delay2/100*battle_config.mob_spawn_delay;
}
// parse MOB_NAME,[MOB LEVEL]