Guess I found a really nasty bug...
Was looking at BM items when I saw some Ring of the Dog priced at 999999999 au. After saving the game and loading it again, the ring was priced at 0 gold.
So I launched the game in debug mode and found the explanation. In object_power(), object flags which contribute to pval will give a power boost stored in the extra_stat_bonus variable. For each pval, the boost is calculated as pval * pval_mult... which is of course negative for any negative pval. Some objects like Rings of the Dog or Amulets of Inertia have a single negative pval. The resulting extra_stat_bonus is then negative. However, extra power is added for objects with high ability bonuses using extra_stat_bonus as an index in a static array:
With extra_stat_bonus negative, the index is out of bounds! The result is completely random, and could even crash on some machines...
Was looking at BM items when I saw some Ring of the Dog priced at 999999999 au. After saving the game and loading it again, the ring was priced at 0 gold.
So I launched the game in debug mode and found the explanation. In object_power(), object flags which contribute to pval will give a power boost stored in the extra_stat_bonus variable. For each pval, the boost is calculated as pval * pval_mult... which is of course negative for any negative pval. Some objects like Rings of the Dog or Amulets of Inertia have a single negative pval. The resulting extra_stat_bonus is then negative. However, extra power is added for objects with high ability bonuses using extra_stat_bonus as an index in a static array:
Code:
pwr += ability_power[extra_stat_bonus / 10];
Comment