dbridge.c wh

wanghao_branch
jiehaoxuan 2 years ago
parent 5a6249f280
commit c67973638f

@ -1,3 +1,4 @@
//2023/12/3 wh
/* NetHack 3.7 dbridge.c $NHDT-Date: 1596498153 2020/08/03 23:42:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@ -58,72 +59,67 @@ is_pool(coordxy x, coordxy y)
return FALSE;
}
boolean
is_lava(coordxy x, coordxy y)
boolean is_lava(coordxy x, coordxy y)
{
schar ltyp;
if (!isok(x, y))
return FALSE;
ltyp = levl[x][y].typ;
if (!isok(x, y)) // If the coordinates are not within the game map
return FALSE; // Return FALSE to indicate that it is not lava
ltyp = levl[x][y].typ; // Get the terrain type at the coordinates
if (ltyp == LAVAPOOL || ltyp == LAVAWALL
|| (ltyp == DRAWBRIDGE_UP
&& (levl[x][y].drawbridgemask & DB_UNDER) == DB_LAVA))
return TRUE;
return FALSE;
return TRUE; // Return TRUE if the terrain type is lava or a drawbridge over lava
return FALSE; // Otherwise, return FALSE
}
boolean
is_pool_or_lava(coordxy x, coordxy y)
boolean is_pool_or_lava(coordxy x, coordxy y)
{
if (is_pool(x, y) || is_lava(x, y))
return TRUE;
return TRUE; // Return TRUE if the location is a pool or lava
else
return FALSE;
return FALSE; // Otherwise, return FALSE
}
boolean
is_ice(coordxy x, coordxy y)
boolean is_ice(coordxy x, coordxy y)
{
schar ltyp;
if (!isok(x, y))
return FALSE;
ltyp = levl[x][y].typ;
if (!isok(x, y)) // If the coordinates are not within the game map
return FALSE; // Return FALSE to indicate that it is not ice
ltyp = levl[x][y].typ; // Get the terrain type at the coordinates
if (ltyp == ICE || (ltyp == DRAWBRIDGE_UP
&& (levl[x][y].drawbridgemask & DB_UNDER) == DB_ICE))
return TRUE;
return FALSE;
return TRUE; // Return TRUE if the terrain type is ice or a drawbridge over ice
return FALSE; // Otherwise, return FALSE
}
boolean
is_moat(coordxy x, coordxy y)
boolean is_moat(coordxy x, coordxy y)
{
schar ltyp;
if (!isok(x, y))
return FALSE;
ltyp = levl[x][y].typ;
if (!isok(x, y)) // If the coordinates are not within the game map
return FALSE; // Return FALSE to indicate that it is not a moat
ltyp = levl[x][y].typ; // Get the terrain type at the coordinates
if (!Is_juiblex_level(&u.uz)
&& (ltyp == MOAT
|| (ltyp == DRAWBRIDGE_UP
&& (levl[x][y].drawbridgemask & DB_UNDER) == DB_MOAT)))
return TRUE;
return FALSE;
return TRUE; // Return TRUE if the terrain type is a moat or a drawbridge over a moat (excluding Juiblex's level)
return FALSE; // Otherwise, return FALSE
}
schar
db_under_typ(int mask)
schar db_under_typ(int mask)
{
switch (mask & DB_UNDER) {
case DB_ICE:
return ICE;
return ICE; // Return the terrain type as ice if the mask corresponds to ice
case DB_LAVA:
return LAVAPOOL;
return LAVAPOOL; // Return the terrain type as lava if the mask corresponds to lava
case DB_MOAT:
return MOAT;
return MOAT; // Return the terrain type as a moat if the mask corresponds to a moat
default:
return STONE;
return STONE; // Return the terrain type as stone for other cases
}
}

Loading…
Cancel
Save