From 19225335bf5add6df9d1cb2b8523ecef0119ba23 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sun, 14 Jul 2002 17:19:40 +0000 Subject: [PATCH] B04008 Minetown fountain warnings prevent fountain gem/gold discovery writes: I can accept that losing gold into a fountain recharges it to make it possible to find a gem in it in future (however weird that is). What _does_ seem wrong is that receiving a warning about a Minetown fountain prevents finding gems and gold there. --- doc/fixes34.1 | 1 + include/rm.h | 6 ++++++ src/dig.c | 2 +- src/fountain.c | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 1ac07ca39..c21d027b8 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -164,6 +164,7 @@ avoid crash when drinking a potion causes the hero to float up over a fire in some situations, if hero stood still, a hostile dwarf would switch back and forth between weapon and pick-axe and never move uncontrolled teleports did not handle leashed pets +minetown fountain warnings shouldn't prevent finding gems/coins in fountain Platform- and/or Interface-Specific Fixes diff --git a/include/rm.h b/include/rm.h index c2da2751e..7996cac3c 100644 --- a/include/rm.h +++ b/include/rm.h @@ -267,6 +267,12 @@ extern const struct symdef def_warnsyms[WARNCOUNT]; */ #define F_LOOTED 1 #define F_WARNED 2 +#define FOUNTAIN_IS_WARNED(x,y) (levl[x][y].looted & F_WARNED) +#define FOUNTAIN_IS_LOOTED(x,y) (levl[x][y].looted & F_LOOTED) +#define SET_FOUNTAIN_WARNED(x,y) levl[x][y].looted |= F_WARNED; +#define SET_FOUNTAIN_LOOTED(x,y) levl[x][y].looted |= F_LOOTED; +#define CLEAR_FOUNTAIN_WARNED(x,y) levl[x][y].looted &= ~F_WARNED; +#define CLEAR_FOUNTAIN_LOOTED(x,y) levl[x][y].looted &= ~F_LOOTED; /* * Doors are even worse :-) The special warning has a side effect diff --git a/src/dig.c b/src/dig.c index e470abe00..fc74204c3 100644 --- a/src/dig.c +++ b/src/dig.c @@ -495,7 +495,7 @@ int ttyp; breaking bypasses that routine and calls us directly */ if (IS_FOUNTAIN(lev->typ)) { dogushforth(FALSE); - lev->looted |= F_WARNED; /* force dryup */ + SET_FOUNTAIN_WARNED(x,y); /* force dryup */ dryup(x, y, madeby_u); return; #ifdef SINKS diff --git a/src/fountain.c b/src/fountain.c index baf5e794b..63effbe7a 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -140,7 +140,7 @@ dofindgem() /* Find a gem in the sparkling waters. */ else You_feel("a gem here!"); (void) mksobj_at(rnd_class(DILITHIUM_CRYSTAL, LUCKSTONE-1), u.ux, u.uy, FALSE, FALSE); - levl[u.ux][u.uy].looted |= F_LOOTED; + SET_FOUNTAIN_LOOTED(u.ux,u.uy); newsym(u.ux, u.uy); exercise(A_WIS, TRUE); /* a discovery! */ } @@ -151,12 +151,12 @@ xchar x, y; boolean isyou; { if (IS_FOUNTAIN(levl[x][y].typ) && - (!rn2(3) || (levl[x][y].looted & F_WARNED))) { + (!rn2(3) || FOUNTAIN_IS_WARNED(x,y))) { s_level *slev = Is_special(&u.uz); if(isyou && slev && slev->flags.town && - !(levl[x][y].looted & F_WARNED)) { + !FOUNTAIN_IS_WARNED(x,y)) { struct monst *mtmp; - levl[x][y].looted |= F_WARNED; + SET_FOUNTAIN_WARNED(x,y); /* Warn about future fountain use. */ for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; @@ -313,7 +313,7 @@ drinkfountain() case 27: /* Find a gem in the sparkling waters. */ - if (!levl[u.ux][u.uy].looted) { + if (!FOUNTAIN_IS_LOOTED(u.ux,u.uy)) { dofindgem(); break; } @@ -426,7 +426,7 @@ register struct obj *obj; dowatersnakes(); break; case 24: /* Find a gem */ - if (!levl[u.ux][u.uy].looted) { + if (!FOUNTAIN_IS_LOOTED(u.ux,u.uy)) { dofindgem(); break; } @@ -446,7 +446,7 @@ register struct obj *obj; if (u.ugold > 10) { u.ugold -= somegold() / 10; You("lost some of your gold in the fountain!"); - levl[u.ux][u.uy].looted &= ~F_LOOTED; + CLEAR_FOUNTAIN_LOOTED(u.ux,u.uy); exercise(A_WIS, FALSE); } #else @@ -465,7 +465,7 @@ register struct obj *obj; if (!otmp->quan) delobj(otmp); } You("lost some of your money in the fountain!"); - levl[u.ux][u.uy].looted &= ~F_LOOTED; + CLEAR_FOUNTAIN_LOOTED(u.ux,u.uy); exercise(A_WIS, FALSE); } } @@ -477,8 +477,8 @@ register struct obj *obj; * surface. After all, there will have been more people going * by. Just like a shopping mall! Chris Woodbury */ - if (levl[u.ux][u.uy].looted) break; - levl[u.ux][u.uy].looted |= F_LOOTED; + if (FOUNTAIN_IS_LOOTED(u.ux,u.uy)) break; + SET_FOUNTAIN_LOOTED(u.ux,u.uy); (void) mkgold((long) (rnd((dunlevs_in_dungeon(&u.uz)-dunlev(&u.uz)+1)*2)+5), u.ux, u.uy); -- 2.49.0