fix github issue #686 - dead code
Reported by argrath: the code in choose_stairs() intended as last resort wouldn't do anything because the loop's test condition always started out false. Fix suggested by entrez. Closes #686
This commit is contained in:
@@ -314,24 +314,25 @@ void
|
|||||||
choose_stairs(xchar *sx, xchar *sy, boolean dir)
|
choose_stairs(xchar *sx, xchar *sy, boolean dir)
|
||||||
{
|
{
|
||||||
xchar x = 0, y = 0;
|
xchar x = 0, y = 0;
|
||||||
stairway *stway = g.stairs;
|
stairway *stway;
|
||||||
boolean stdir = dir && !builds_up(&u.uz);
|
boolean stdir = dir && !builds_up(&u.uz);
|
||||||
|
|
||||||
if ((stway = stairway_find_type_dir(FALSE, stdir)) != 0) {
|
if ((stway = stairway_find_type_dir(FALSE, stdir)) != 0) {
|
||||||
|
/* stairs in direction 'stdir' */
|
||||||
x = stway->sx;
|
x = stway->sx;
|
||||||
y = stway->sy;
|
y = stway->sy;
|
||||||
} else if ((stway = stairway_find_type_dir(TRUE, stdir)) != 0) {
|
} else if ((stway = stairway_find_type_dir(TRUE, stdir)) != 0) {
|
||||||
|
/* ladder in direction 'stdir' */
|
||||||
x = stway->sx;
|
x = stway->sx;
|
||||||
y = stway->sy;
|
y = stway->sy;
|
||||||
} else {
|
} else {
|
||||||
while (stway) {
|
/* branch stairs in any direction */
|
||||||
|
for (stway = g.stairs; stway; stway = stway->next)
|
||||||
if (stway->tolev.dnum != u.uz.dnum) {
|
if (stway->tolev.dnum != u.uz.dnum) {
|
||||||
x = stway->sx;
|
x = stway->sx;
|
||||||
y = stway->sy;
|
y = stway->sy;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stway = stway->next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isok(x, y)) {
|
if (isok(x, y)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user