- Some overflow protections on calculation of max hp. Now when max hp becomes negative, it is bumped to the server's max_hp setting (it is assumed there was an overflow)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5493 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
5c27631619
commit
0078db6a30
@ -5,6 +5,10 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
|
|||||||
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
||||||
|
|
||||||
2006/03/07
|
2006/03/07
|
||||||
|
* status_calc_pc now assumes that if your max hp is negative, it has
|
||||||
|
overflowed, and as such, it is set to the max_hp setting instead of 1. This
|
||||||
|
'dangerous' assumptio is alright as long as there aren't equipment that can
|
||||||
|
send your hp to negative values. [Skotlex]
|
||||||
- Fixed the soul linker skill tree. (Thanks to muad_dib) [Zephiris]
|
- Fixed the soul linker skill tree. (Thanks to muad_dib) [Zephiris]
|
||||||
* Added Gunslinger and Ninja into @job. of course, you need latest EXE
|
* Added Gunslinger and Ninja into @job. of course, you need latest EXE
|
||||||
for make this work... and of course no skills yet! [Vicious]
|
for make this work... and of course no skills yet! [Vicious]
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "pc.h"
|
#include "pc.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
@ -1375,10 +1376,13 @@ int status_calc_pc(struct map_session_data* sd,int first)
|
|||||||
if(battle_config.hp_rate != 100)
|
if(battle_config.hp_rate != 100)
|
||||||
sd->status.max_hp = sd->status.max_hp * battle_config.hp_rate/100;
|
sd->status.max_hp = sd->status.max_hp * battle_config.hp_rate/100;
|
||||||
|
|
||||||
if(sd->status.max_hp > battle_config.max_hp)
|
if (sd->status.max_hp < 0) //HP overflow??
|
||||||
sd->status.max_hp = battle_config.max_hp;
|
sd->status.max_hp = battle_config.max_hp;
|
||||||
else if(sd->status.max_hp <= 0)
|
else if(sd->status.max_hp > battle_config.max_hp)
|
||||||
|
sd->status.max_hp = battle_config.max_hp;
|
||||||
|
else if(sd->status.max_hp == 0)
|
||||||
sd->status.max_hp = 1;
|
sd->status.max_hp = 1;
|
||||||
|
|
||||||
if(sd->status.hp>sd->status.max_hp)
|
if(sd->status.hp>sd->status.max_hp)
|
||||||
sd->status.hp=sd->status.max_hp;
|
sd->status.hp=sd->status.max_hp;
|
||||||
|
|
||||||
@ -5623,7 +5627,8 @@ int status_change_clear_debuffs (struct block_list *bl)
|
|||||||
|
|
||||||
static int status_calc_sigma(void)
|
static int status_calc_sigma(void)
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int i,j;
|
||||||
|
unsigned int k;
|
||||||
|
|
||||||
for(i=0;i<MAX_PC_CLASS;i++) {
|
for(i=0;i<MAX_PC_CLASS;i++) {
|
||||||
memset(hp_sigma_val[i],0,sizeof(hp_sigma_val[i]));
|
memset(hp_sigma_val[i],0,sizeof(hp_sigma_val[i]));
|
||||||
@ -5631,7 +5636,11 @@ static int status_calc_sigma(void)
|
|||||||
k += hp_coefficient[i]*j + 50;
|
k += hp_coefficient[i]*j + 50;
|
||||||
k -= k%100;
|
k -= k%100;
|
||||||
hp_sigma_val[i][j-1] = k;
|
hp_sigma_val[i][j-1] = k;
|
||||||
|
if (k >= INT_MAX)
|
||||||
|
break; //Overflow protection. [Skotlex]
|
||||||
}
|
}
|
||||||
|
for(;j<=MAX_LEVEL;j++)
|
||||||
|
hp_sigma_val[i][j-1] = INT_MAX;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user