Fix crash during restore when mounted

The new "riding blocks stealth" code was reading u.usteed at an
early point in the restore process, before its value was reliable
(dorecover()->restgamestate()->set_uasmon()->steed_vs_stealth());
because restgamestate() happens prior to restlevelstate(), the
value of u.usteed will be a stale pointer from some previous game,
and attempting to determine whether the steed is flying will crash
the game.

steed_vs_stealth() doesn't actually need to be called during the
restore process (because BStealth is saved in the save file), so
this can be easily fixed by omitting the call to it during the
restore.
This commit is contained in:
Alex Smith
2023-12-13 01:33:24 +00:00
parent 8b5e9eadb1
commit 2413ac2be7

View File

@@ -105,7 +105,12 @@ set_uasmon(void)
PROPSET(BLINDED, !haseyes(mdat));
#undef PROPSET
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
/* whether the player is flying/floating depends on their steed,
which won't be known during the restore process: but BFlying
and BStealth should be set correctly already in that case, so
there's nothing to do */
if (!gp.program_state.restoring)
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
polysense();
#ifdef STATUS_HILITES