Rework stairs structure

Use a linked list to store stair and ladder information, instead
of having fixed up/down stairs/ladders and a single "special" (branch)
stair.

Breaks saves and bones.

Adds information to migrating objects and monsters for the dungeon
and level where they are migrating from.
This commit is contained in:
Pasi Kallinen
2020-11-09 18:50:02 +02:00
parent e23f764d11
commit 6ec55a3624
34 changed files with 552 additions and 361 deletions

View File

@@ -329,30 +329,26 @@ xchar *sx;
xchar *sy;
{
xchar x = 0, y = 0;
stairway *stway = g.stairs;
boolean stdir = !builds_up(&u.uz);
if (builds_up(&u.uz)) {
if (xdnstair) {
x = xdnstair;
y = ydnstair;
} else if (xdnladder) {
x = xdnladder;
y = ydnladder;
}
if ((stway = stairway_find_type_dir(FALSE, stdir)) != 0) {
x = stway->sx;
y = stway->sy;
} else if ((stway = stairway_find_type_dir(TRUE, stdir)) != 0) {
x = stway->sx;
y = stway->sy;
} else {
if (xupstair) {
x = xupstair;
y = yupstair;
} else if (xupladder) {
x = xupladder;
y = yupladder;
while (stway) {
if (stway->tolev.dnum != u.uz.dnum) {
x = stway->sx;
y = stway->sy;
break;
}
stway = stway->next;
}
}
if (!x && g.sstairs.sx) {
x = g.sstairs.sx;
y = g.sstairs.sy;
}
if (x && y) {
*sx = x;
*sy = y;