summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-10 03:17:19 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-10 03:17:19 +0000
commitfeb238739734f3679c872150a5cc8a641543d081 (patch)
tree792f08c86aafb07590d8c5eb9f925efa231a5f34 /src/map/mob.c
parent02970d7f1eb4e67ad850d140ff9acebc63d31036 (diff)
downloadhercules-feb238739734f3679c872150a5cc8a641543d081.tar.gz
hercules-feb238739734f3679c872150a5cc8a641543d081.tar.bz2
hercules-feb238739734f3679c872150a5cc8a641543d081.tar.xz
hercules-feb238739734f3679c872150a5cc8a641543d081.zip
- Added range checking to mob skill loading of permillage and delay.
- Fixed pc_gainexp not working for next level exp requirements above INT_MAX. - Fixed the display of @showexp not working right for exp values above INT_MAX. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5242 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 5772db551..590cbf323 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4539,7 +4539,7 @@ static int mob_readskilldb(void)
{
FILE *fp;
char line[1024];
- int i;
+ int i,tmp;
const struct {
char str[32];
@@ -4686,13 +4686,19 @@ static int mob_readskilldb(void)
ms->skill_lv= j>battle_config.mob_max_skilllvl ? battle_config.mob_max_skilllvl : j; //we strip max skill level
//Apply battle_config modifiers to rate (permillage) and delay [Skotlex]
- ms->permillage=atoi(sp[5]);
+ tmp = atoi(sp[5]);
if (battle_config.mob_skill_rate != 100)
- ms->permillage = ms->permillage*battle_config.mob_skill_rate/100;
+ tmp = tmp*battle_config.mob_skill_rate/100;
+ if (tmp > 10000)
+ ms->permillage= 10000;
+ else
+ ms->permillage= tmp;
ms->casttime=atoi(sp[6]);
ms->delay=atoi(sp[7]);
if (battle_config.mob_skill_delay != 100)
ms->delay = ms->delay*battle_config.mob_skill_delay/100;
+ if (ms->delay < 0) //time overflow?
+ ms->delay = INT_MAX;
ms->cancel=atoi(sp[8]);
if( strcmp(sp[8],"yes")==0 ) ms->cancel=1;
ms->target=atoi(sp[9]);