Safety valve against candelabrum's .age becoming 0

This may have happened in a 3.7 game on Hardfought. Even if it didn't,
I'm still uncomfortable with the potential for the game to potentially
become unwinnable as a consequence of age field corruption. Add an
impossible() for when this situation happens, and code after the
impossible() to repair the game by removing the candles.
This commit is contained in:
Alex Smith
2020-03-18 23:00:31 +00:00
parent b0e645a650
commit 564dd1db8d

View File

@@ -1188,6 +1188,13 @@ register struct obj *obj;
1 would yield 0, confusing begin_burn() and producing an
unlightable, unrefillable candelabrum; round up instead */
obj->age = (obj->age + 1L) / 2L;
/* to make absolutely sure the game doesn't become unwinnable as
a consequence of a broken candelabrum */
if (obj->age == 0) {
impossible("Candelabrum with candles but no fuel?");
obj->age = 1;
}
} else {
if (obj->spe == 7) {
if (Blind)