don't miss the special furniture checks during liquid flow

Closes #405
This commit is contained in:
nhmall
2020-12-11 16:28:59 -05:00
parent abca3d26db
commit 6dc033e5d8
2 changed files with 36 additions and 21 deletions

View File

@@ -419,6 +419,8 @@ options help ('? g') listed all boolean options, then repeated them among
change name of #wizlevelflip to #wizfliplevel change name of #wizlevelflip to #wizfliplevel
dwarves could sometimes pass through walls without digging their way dwarves could sometimes pass through walls without digging their way
fix genetic engineers dropping Schroedinger's cat box 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 curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support also included tty support

View File

@@ -13,6 +13,7 @@ static int NDECL(dig);
static void FDECL(dig_up_grave, (coord *)); static void FDECL(dig_up_grave, (coord *));
static int FDECL(adj_pit_checks, (coord *, char *)); static int FDECL(adj_pit_checks, (coord *, char *));
static void FDECL(pit_flow, (struct trap *, SCHAR_P)); static void FDECL(pit_flow, (struct trap *, SCHAR_P));
static boolean FDECL(furniture_handled, (int, int, BOOLEAN_P));
/* Indices returned by dig_typ() */ /* Indices returned by dig_typ() */
enum dig_types { enum dig_types {
@@ -489,6 +490,33 @@ dig(VOID_ARGS)
return 1; 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. */ /* When will hole be finished? Very rough indication used by shopkeeper. */
int int
holetime() holetime()
@@ -558,25 +586,8 @@ int ttyp;
reset_utrap(FALSE); reset_utrap(FALSE);
} }
/* these furniture checks were in dighole(), but wand if (furniture_handled(x, y, madeby_u))
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; return;
} else if (IS_SINK(lev->typ)) {
breaksink(x, y);
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)) { if (ttyp != PIT && (!Can_dig_down(&u.uz) && !lev->candig)) {
impossible("digactualhole: can't dig %s on this level.", impossible("digactualhole: can't dig %s on this level.",
@@ -876,9 +887,11 @@ coord *cc;
lev->flags = 0; lev->flags = 0;
if (typ != ROOM) { if (typ != ROOM) {
lev->typ = typ; if (!furniture_handled((int) dig_x, (int) dig_y, TRUE)) {
liquid_flow(dig_x, dig_y, typ, ttmp, lev->typ = typ;
"As you dig, the hole fills with %s!"); liquid_flow(dig_x, dig_y, typ, ttmp,
"As you dig, the hole fills with %s!");
}
return TRUE; return TRUE;
} }