Bug #1676
openhitpoints = 0 in units.ruleset causes divide by 0 crash
0%
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
Updated by Marko Lindqvist 8 days ago
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.
Updated by Marko Lindqvist 8 days ago
secfile_lookup_int_default_min_max() would be your friend.
Updated by Dean Brown 7 days ago
- File 1676_S3_2.patch added
- File 1676_S3_3_Main.patch added
Agree, better to fix the cause instead of the symptom.
Updated by Marko Lindqvist 3 days ago
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.
Updated by Dean Brown 2 days ago
- File 1676_S3_2.patch 1676_S3_2.patch added
- File 1676_S3_3_Main.patch 1676_S3_3_Main.patch added
I wasn't sure about what max value to set, thanks for the suggestion. Updated the patches.