From: nhmall Date: Fri, 11 Dec 2020 21:28:59 +0000 (-0500) Subject: don't miss the special furniture checks during liquid flow X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6dc033e5d8f482bbd8fe813bbaf60df7022a8456;p=nethack don't miss the special furniture checks during liquid flow Closes #405 --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index cc5b3f954..5f7211531 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -419,6 +419,8 @@ options help ('? g') listed all boolean options, then repeated them among change name of #wizlevelflip to #wizfliplevel dwarves could sometimes pass through walls without digging their way fix genetic engineers dropping Schroedinger's cat box +the checks and handling for fountains, sinks, and drawbridges were being + missed during liquid_flow curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/dig.c b/src/dig.c index 7c3e603c2..15553d11b 100644 --- a/src/dig.c +++ b/src/dig.c @@ -13,6 +13,7 @@ static int NDECL(dig); static void FDECL(dig_up_grave, (coord *)); static int FDECL(adj_pit_checks, (coord *, char *)); static void FDECL(pit_flow, (struct trap *, SCHAR_P)); +static boolean FDECL(furniture_handled, (int, int, BOOLEAN_P)); /* Indices returned by dig_typ() */ enum dig_types { @@ -489,6 +490,33 @@ dig(VOID_ARGS) return 1; } +static boolean +furniture_handled(x, y, madeby_u) +int x, y; +boolean madeby_u; +{ + struct rm *lev = &levl[x][y]; + + if (IS_FOUNTAIN(lev->typ)) { + dogushforth(FALSE); + SET_FOUNTAIN_WARNED(x, y); /* force dryup */ + dryup(x, y, madeby_u); + } else if (IS_SINK(lev->typ)) { + breaksink(x, y); + } else if (lev->typ == DRAWBRIDGE_DOWN + || (is_drawbridge_wall(x, y) >= 0)) { + int bx = x, by = y; + + /* if under the portcullis, the bridge is adjacent */ + (void) find_drawbridge(&bx, &by); + destroy_drawbridge(bx, by); + } else { + return FALSE; + } + return TRUE; +} + + /* When will hole be finished? Very rough indication used by shopkeeper. */ int holetime() @@ -558,25 +586,8 @@ int ttyp; reset_utrap(FALSE); } - /* these furniture checks were in dighole(), but wand - breaking bypasses that routine and calls us directly */ - if (IS_FOUNTAIN(lev->typ)) { - dogushforth(FALSE); - SET_FOUNTAIN_WARNED(x, y); /* force dryup */ - dryup(x, y, madeby_u); - return; - } else if (IS_SINK(lev->typ)) { - breaksink(x, y); + if (furniture_handled(x, y, madeby_u)) return; - } else if (lev->typ == DRAWBRIDGE_DOWN - || (is_drawbridge_wall(x, y) >= 0)) { - int bx = x, by = y; - - /* if under the portcullis, the bridge is adjacent */ - (void) find_drawbridge(&bx, &by); - destroy_drawbridge(bx, by); - return; - } if (ttyp != PIT && (!Can_dig_down(&u.uz) && !lev->candig)) { impossible("digactualhole: can't dig %s on this level.", @@ -876,9 +887,11 @@ coord *cc; lev->flags = 0; if (typ != ROOM) { - lev->typ = typ; - liquid_flow(dig_x, dig_y, typ, ttmp, - "As you dig, the hole fills with %s!"); + if (!furniture_handled((int) dig_x, (int) dig_y, TRUE)) { + lev->typ = typ; + liquid_flow(dig_x, dig_y, typ, ttmp, + "As you dig, the hole fills with %s!"); + } return TRUE; }