Prevent hero from falling past end of dungeon
Similar story with saved trap door destinations: if a bones file near the end of the dungeon came from a longer dungeon (i.e. with a lower-depth castle) than the one the bones file is loaded into, the trap door destination could be past the dungeon end. Clamp the destination so it won't be lower than the bottom level of the dungeon.
This commit is contained in:
committed by
Pasi Kallinen
parent
9bb09d48f1
commit
1830b206c7
@@ -580,15 +580,18 @@ fall_through(
|
||||
if (Is_stronghold(&u.uz)) {
|
||||
find_hell(&dtmp);
|
||||
} else {
|
||||
int dist = newlevel - dunlev(&u.uz);
|
||||
int dist;
|
||||
|
||||
if (t) {
|
||||
dtmp.dnum = t->dst.dnum;
|
||||
dtmp.dlevel = t->dst.dlevel;
|
||||
/* don't fall beyond the bottom, in case this came from a bones
|
||||
file with different dungeon size */
|
||||
dtmp.dlevel = min(t->dst.dlevel, bottom);
|
||||
dist = dtmp.dlevel - dunlev(&u.uz);
|
||||
} else {
|
||||
dtmp.dnum = u.uz.dnum;
|
||||
dtmp.dlevel = newlevel;
|
||||
dist = newlevel - dunlev(&u.uz);
|
||||
}
|
||||
if (dist > 1)
|
||||
You("fall down a %s%sshaft!", dist > 3 ? "very " : "",
|
||||
|
||||
Reference in New Issue
Block a user