Fix segfault when the Wizard tried teleporting on the planes

The wizard of Yendor tried teleporting to the stairs on the
plane of Earth, but there are none there.

This was caused by the stairs structure reworking.

Fixes #422
This commit is contained in:
Pasi Kallinen
2020-12-14 17:46:57 +02:00
parent 1b415af302
commit 480c253933

View File

@@ -1284,7 +1284,6 @@ struct monst *mtmp; /* mx==0 implies migrating monster arrival */
boolean suppress_impossible;
{
register int x, y, trycount;
stairway *stway;
if (mtmp == u.usteed) {
tele();
@@ -1292,19 +1291,19 @@ boolean suppress_impossible;
}
if (mtmp->iswiz && mtmp->mx) { /* Wizard, not just arriving */
stairway *stway;
if (!In_W_tower(u.ux, u.uy, &u.uz)) {
stway = stairway_find_forwiz(FALSE, TRUE);
x = stway->sx;
y = stway->sy;
} else if (!stairway_find_forwiz(TRUE, FALSE)) { /* bottom level of tower */
stway = stairway_find_forwiz(TRUE, TRUE);
x = stway->sx;
y = stway->sy;
} else {
stway = stairway_find_forwiz(TRUE, FALSE);
x = stway->sx;
y = stway->sy;
}
x = stway ? stway->sx : 0;
y = stway ? stway->sy : 0;
/* if the wiz teleports away to heal, try the up staircase,
to block the player's escaping before he's healed
(deliberately use `goodpos' rather than `rloc_pos_ok' here) */