diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 09d6858ea..50009c5db 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -52,6 +52,7 @@ poly'd hero was able to zap wands, apply tools, and #rub objects without having any hands spellcasting monster got an extra move after casting allow defining #wizgenesis quantity in the prompt +digging through iron bars from an adjacent pit made a pit on top of the bars Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index fb493078c..d3b7eab20 100644 --- a/include/extern.h +++ b/include/extern.h @@ -630,6 +630,9 @@ E void FDECL(u_on_sstairs, (int)); E void NDECL(u_on_upstairs); E void NDECL(u_on_dnstairs); E boolean FDECL(On_stairs, (XCHAR_P, XCHAR_P)); +E boolean FDECL(On_ladder, (XCHAR_P, XCHAR_P)); +E boolean FDECL(On_stairs_up, (XCHAR_P, XCHAR_P)); +E boolean FDECL(On_stairs_dn, (XCHAR_P, XCHAR_P)); E void FDECL(get_level, (d_level *, int)); E boolean FDECL(Is_botlevel, (d_level *)); E boolean FDECL(Can_fall_thru, (d_level *)); @@ -1551,6 +1554,7 @@ E boolean FDECL(monhaskey, (struct monst *, BOOLEAN_P)); E void FDECL(mon_regen, (struct monst *, BOOLEAN_P)); E int FDECL(dochugw, (struct monst *)); E boolean FDECL(onscary, (int, int, struct monst *)); +E struct monst *FDECL(find_pmmonst, (int)); E int FDECL(bee_eat_jelly, (struct monst *, struct obj *)); E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P)); E void FDECL(mon_yells, (struct monst *, const char *)); diff --git a/src/cmd.c b/src/cmd.c index 34bedb284..4264e1e28 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -3835,17 +3835,13 @@ boolean doit; add_herecmd_menuitem(win, dosit, "Sit on the throne"); - if ((u.ux == xupstair && u.uy == yupstair) - || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy && g.sstairs.up) - || (u.ux == xupladder && u.uy == yupladder)) { + if (On_stairs_up(u.ux, u.uy)) { Sprintf(buf, "Go up the %s", (u.ux == xupladder && u.uy == yupladder) ? "ladder" : "stairs"); add_herecmd_menuitem(win, doup, buf); } - if ((u.ux == xdnstair && u.uy == ydnstair) - || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy && !g.sstairs.up) - || (u.ux == xdnladder && u.uy == ydnladder)) { + if (On_stairs_dn(u.ux, u.uy)) { Sprintf(buf, "Go down the %s", (u.ux == xupladder && u.uy == yupladder) ? "ladder" : "stairs"); @@ -3955,16 +3951,10 @@ int x, y, mod; } else if (IS_THRONE(levl[u.ux][u.uy].typ)) { cmd[0] = cmd_from_func(dosit); return cmd; - } else if ((u.ux == xupstair && u.uy == yupstair) - || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy - && g.sstairs.up) - || (u.ux == xupladder && u.uy == yupladder)) { + } else if (On_stairs_up(u.ux, u.uy)) { cmd[0] = cmd_from_func(doup); return cmd; - } else if ((u.ux == xdnstair && u.uy == ydnstair) - || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy - && !g.sstairs.up) - || (u.ux == xdnladder && u.uy == ydnladder)) { + } else if (On_stairs_dn(u.ux, u.uy)) { cmd[0] = cmd_from_func(dodown); return cmd; } else if ((o = vobj_at(u.ux, u.uy)) != 0) { diff --git a/src/dig.c b/src/dig.c index e86eb5eef..7f08ce170 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1635,6 +1635,7 @@ char *msg; } else if (ltyp == IRONBARS) { /* "set of iron bars" */ Strcpy(msg, "The bars go much deeper than your pit."); + return FALSE; #if 0 } else if (is_lava(cc->x, cc->y)) { } else if (is_ice(cc->x, cc->y)) { @@ -1644,8 +1645,7 @@ char *msg; } else if (IS_SINK(ltyp)) { Strcpy(msg, "A tangled mass of plumbing remains below the sink."); return FALSE; - } else if ((cc->x == xupladder && cc->y == yupladder) /* ladder up */ - || (cc->x == xdnladder && cc->y == ydnladder)) { /* " down */ + } else if (On_ladder(cc->x, cc->y)) { Strcpy(msg, "The ladder is unaffected."); return FALSE; } else { @@ -1657,15 +1657,8 @@ char *msg; supporting = "throne"; else if (IS_ALTAR(ltyp)) supporting = "altar"; - else if ((cc->x == xupstair && cc->y == yupstair) - || (cc->x == g.sstairs.sx && cc->y == g.sstairs.sy - && g.sstairs.up)) - /* "staircase up" */ - supporting = "stairs"; - else if ((cc->x == xdnstair && cc->y == ydnstair) - || (cc->x == g.sstairs.sx && cc->y == g.sstairs.sy - && !g.sstairs.up)) - /* "staircase down" */ + else if (On_stairs(cc->x, cc->y)) + /* staircase up or down. On_ladder handled above. */ supporting = "stairs"; else if (ltyp == DRAWBRIDGE_DOWN /* "lowered drawbridge" */ || ltyp == DBWALL) /* "raised drawbridge" */ diff --git a/src/dog.c b/src/dog.c index 5b9cfed69..05f693390 100644 --- a/src/dog.c +++ b/src/dog.c @@ -755,17 +755,10 @@ register struct obj *obj; return POISON; if (obj->otyp == LUMP_OF_ROYAL_JELLY && mon->data == &mons[PM_KILLER_BEE]) { - struct monst *mtmp = 0; + struct monst *mtmp = find_pmmonst(PM_QUEEN_BEE); /* if there's a queen bee on the level, don't eat royal jelly; if there isn't, do eat it and grow into a queen */ - if ((g.mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0) - for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { - if (DEADMONSTER(mtmp)) - continue; - if (mtmp->data == &mons[PM_QUEEN_BEE]) - break; - } return !mtmp ? DOGFOOD : TABU; } if (!carni && !herbi) diff --git a/src/dungeon.c b/src/dungeon.c index 9546b7c3a..59473d6c3 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1524,6 +1524,32 @@ xchar x, y; || (x == g.sstairs.sx && y == g.sstairs.sy)); } +boolean +On_ladder(x, y) +xchar x, y; +{ + return (boolean) ((x == xdnladder && y == ydnladder) + || (x == xupladder && y == yupladder)); +} + +boolean +On_stairs_up(x, y) +xchar x, y; +{ + return ((x == xupstair && y == yupstair) + || (x == g.sstairs.sx && y == g.sstairs.sy && g.sstairs.up) + || (x == xupladder && y == yupladder)); +} + +boolean +On_stairs_dn(x, y) +xchar x, y; +{ + return ((x == xdnstair && y == ydnstair) + || (x == g.sstairs.sx && y == g.sstairs.sy && !g.sstairs.up) + || (x == xdnladder && y == ydnladder)); +} + boolean Is_botlevel(lev) d_level *lev; diff --git a/src/monmove.c b/src/monmove.c index 4d18d2850..b58d29303 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -252,6 +252,23 @@ struct monst *mon; } } +struct monst * +find_pmmonst(pm) +int pm; +{ + struct monst *mtmp = 0; + + if ((g.mvitals[pm].mvflags & G_GENOD) == 0) + for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { + if (DEADMONSTER(mtmp)) + continue; + if (mtmp->data == &mons[pm]) + break; + } + + return mtmp; +} + /* killer bee 'mon' is on a spot containing lump of royal jelly 'obj' and will eat it if there is no queen bee on the level; return 1: mon died, 0: mon ate jelly and lived; -1: mon didn't eat jelly to use its move */ @@ -261,16 +278,8 @@ struct monst *mon; struct obj *obj; { int m_delay; - struct monst *mtmp = 0; + struct monst *mtmp = find_pmmonst(PM_QUEEN_BEE); - /* find a queen bee */ - if ((g.mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0) - for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { - if (DEADMONSTER(mtmp)) - continue; - if (mtmp->data == &mons[PM_QUEEN_BEE]) - break; - } /* if there's no queen on the level, eat the royal jelly and become one */ if (!mtmp) { m_delay = obj->blessed ? 3 : !obj->cursed ? 5 : 7;