Fix stairs on oracle level bones

Recent change to the stairs structure now lets each stair keep
the destination level number and dungeon where the stairs go to.

When a level that can be on different depth (such as the Oracle)
became a bones level, and it was loaded in another game at different
depth, the stairs were still pointing to the old level number.

Save it as relative to the current level instead of absolute.
This commit is contained in:
Pasi Kallinen
2020-12-03 16:38:17 +02:00
parent a03cce0505
commit cf88808285
2 changed files with 12 additions and 0 deletions

View File

@@ -926,6 +926,10 @@ NHFILE *nhfp;
if (nhfp->structlevel) {
len += (int) sizeof (stairway);
mread(nhfp->fd, (genericptr_t) &stway, sizeof (stairway));
if (stway.tolev.dnum == u.uz.dnum) {
/* stairway dlevel is relative, make it absolute */
stway.tolev.dlevel += u.uz.dlevel;
}
}
stairway_add(stway.sx, stway.sy, stway.up, stway.isladder,

View File

@@ -669,8 +669,16 @@ NHFILE *nhfp;
while (stway) {
if (perform_bwrite(nhfp)) {
if (nhfp->structlevel) {
if (stway->tolev.dnum == u.uz.dnum) {
/* make dlevel relative to current level */
stway->tolev.dlevel -= u.uz.dlevel;
}
bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen);
bwrite(nhfp->fd, (genericptr_t) stway, sizeof *stway);
if (stway->tolev.dnum == u.uz.dnum) {
/* reset staiway dlevel back to absolute */
stway->tolev.dlevel += u.uz.dlevel;
}
}
}
stway = stway->next;