Bug #1676
open
hitpoints = 0 in units.ruleset causes divide by 0 crash
Added by Dean Brown 8 days ago.
Updated 2 days ago.
Description
Careless rule set hacking strikes again, but there's nothing warning you not to set hitpoints = 0 in units.ruleset, and the ruleset loads OK.
In tilespec.c routine fill_unit_sprite_array()
ihp = ((NUM_TILES_HP_BAR-1)*punit->hp) / ptype->hp;
Files
Patch should be good for all branches.
That's unlikely to be the only place where such a zombie (unit dies when it reach 0 HP) causes problems. The fix should be in ruleset sanity checking.
secfile_lookup_int_default_min_max() would be your friend.
- File deleted (
1676.patch)
- File 1676_S3_2.patch added
- File 1676_S3_3_Main.patch added
Agree, better to fix the cause instead of the symptom.
For rulesets that play excessively with better firepower and hitpoints as game progresses, maximum hp of 100 is rather low upper limit, especially in S3_2 where we should not break any existing rulesets (d3f). I'd say 10000 would be safe value even as such absolute maximum.
- File deleted (
1676_S3_2.patch)
- File deleted (
1676_S3_3_Main.patch)
I wasn't sure about what max value to set, thanks for the suggestion. Updated the patches.
Also available in: Atom
PDF