- Corrected statp array not being long enough to actually hold the status points of ALL levels up to and including MAX_LEVEL. Fixes reaching final level and resetting giving you an unpredictable amount of status points.

- pc_resetstate will now fail if you use the stat point table and your char has a level above MAX_LEVEL.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10084 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2007-03-28 13:51:18 +00:00
parent 9d77814b36
commit 2049f1ad43
2 changed files with 16 additions and 4 deletions

View File

@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/03/28
* Corrected statp array not being long enough to actually hold the status
points of ALL levels up to and including MAX_LEVEL. Fixes reaching final
level and resetting giving you an unpredictable amount of status points.
2007/03/28 2007/03/28
* Negative aspd rate bonuses will be handled as aspd add rate since the * Negative aspd rate bonuses will be handled as aspd add rate since the
default non-stackable bonus is useless on penalty bonuses. default non-stackable bonus is useless on penalty bonuses.

View File

@ -46,7 +46,7 @@
#define PVP_CALCRANK_INTERVAL 1000 // PVP<56>ˆÊŒvŽZÌŠÔŠu #define PVP_CALCRANK_INTERVAL 1000 // PVP<56>ˆÊŒvŽZÌŠÔŠu
static unsigned int exp_table[MAX_PC_CLASS][2][MAX_LEVEL]; static unsigned int exp_table[MAX_PC_CLASS][2][MAX_LEVEL];
static unsigned int max_level[MAX_PC_CLASS][2]; static unsigned int max_level[MAX_PC_CLASS][2];
static short statp[MAX_LEVEL]; static short statp[MAX_LEVEL+1];
// h-files are for declarations, not for implementations... [Shinomori] // h-files are for declarations, not for implementations... [Shinomori]
struct skill_tree_entry skill_tree[MAX_PC_CLASS][MAX_SKILL_TREE]; struct skill_tree_entry skill_tree[MAX_PC_CLASS][MAX_SKILL_TREE];
@ -4690,6 +4690,14 @@ int pc_resetstate(struct map_session_data* sd)
if (battle_config.use_statpoint_table) if (battle_config.use_statpoint_table)
{ // New statpoint table used here - Dexity { // New statpoint table used here - Dexity
int stat; int stat;
if (sd->status.base_level > MAX_LEVEL)
{ //statp[] goes out of bounds, can't reset!
if (battle_config.error_log)
ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n",
sd->status.account_id, sd->status.char_id, sd->status.base_level,
MAX_LEVEL);
return 0;
}
stat = statp[sd->status.base_level]; stat = statp[sd->status.base_level];
if (sd->class_&JOBL_UPPER) if (sd->class_&JOBL_UPPER)
stat+=52; // extra 52+48=100 stat points stat+=52; // extra 52+48=100 stat points
@ -4737,7 +4745,7 @@ int pc_resetstate(struct map_session_data* sd)
clif_updatestatus(sd,SP_STATUSPOINT); clif_updatestatus(sd,SP_STATUSPOINT);
status_calc_pc(sd,0); status_calc_pc(sd,0);
return 0; return 1;
} }
/*========================================== /*==========================================
@ -7533,7 +7541,7 @@ int pc_readdb(void)
continue; continue;
if ((j=atoi(line))<0) if ((j=atoi(line))<0)
j=0; j=0;
if (i >= MAX_LEVEL) if (i > MAX_LEVEL)
break; break;
statp[i]=j; statp[i]=j;
i++; i++;
@ -7542,7 +7550,7 @@ int pc_readdb(void)
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","statpoint.txt"); ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","statpoint.txt");
} }
// generate the remaining parts of the db if necessary // generate the remaining parts of the db if necessary
for (; i < MAX_LEVEL; i++) { for (; i <= MAX_LEVEL; i++) {
j += (i+15)/5; j += (i+15)/5;
statp[i] = j; statp[i] = j;
} }