Issue information

Issue ID
#4575
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Nov 27, 2010 11:58
Last Post
Hercules Elf Bot
Nov 27, 2010 11:58
Confirmation
N/A

Hercules Elf Bot - Nov 27, 2010 11:58

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4575

There is an off-by-one error in pc.c in the code that reads statpoint.txt and then proceeds to calculate the values for the remaining levels up to MAX_LEVEL. The statpoint bonus increases by 1 every 5 levels, so this causes the +1 bonus to occur one level earlier than it should.

Looking at the svn history, around r1000 the statpoint table was short statp[MAX_LEVEL] and indexed from offset 0 instead of 1. This meant that all lookups by level required using the value level-1. In r1094 Celest somehow missed this and used statp[lv]. This then lead to another faulty fix in r1133 where he upped the base index to 1.

Since the statp table was only used in one single place, this fixed the problem. One issue with this is that it made the statp table only go up to MAX_LEVEL instead of MAX_LEVEL+1, cutting off the final level. However, since back then MAX_LEVEL went up to 255, noone noticed. Another issue is that it broke the stat point calculation equation like I described in the beginning.

The first issue was discovered by me after clipping MAX_LEVEL to 99 in r10071, fixing it in r10084. Now to fix the other one.