R759 - delayed were change could cause crash

moveloop() sets a flag when a were/poly change should occur, but it
delays this change if the hero is Unchanging or cannot be interrupted (e.g.
praying).  However, by the time the change can be applied, the reason
may no longer be valid.  Reset the change indicator when this is the case.
Avoids possible strange polymorphs and were crashes.
This commit is contained in:
cohrs
2002-04-06 17:24:15 +00:00
parent c6a8fbdd83
commit 268b70e4e3
2 changed files with 5 additions and 0 deletions

View File

@@ -233,6 +233,10 @@ moveloop()
}
#endif
}
/* delayed change may not be valid anymore */
if ((change == 1 && !Polymorph) ||
(change == 2 && u.ulycn == NON_PM))
change = 0;
if(Polymorph && !rn2(100))
change = 1;
else if (u.ulycn >= LOW_PM && !rn2(80 - (20 * night())))