ceiling and surface relocations and adjustments
relocate surface(), ceiling(), and avoid_ceiling() to dungeon.c adjacent to has_ceiling() etc. astral and fire, like airlevel and waterlevel return FALSE for has_ceiling() if a caller does happen to call ceiling() on fire level, return "flames above" if a caller does happen to call ceiling() on quest level, return a more-generic "expanse above", instead of the word "ceiling" add "stairs" return to surface() remove recent update to engrave.c to special-case "stairs" since surface() will return that now
This commit is contained in:
@@ -1719,8 +1719,95 @@ Can_rise_up(coordxy x, coordxy y, d_level *lev)
|
||||
boolean
|
||||
has_ceiling(d_level *lev)
|
||||
{
|
||||
/* [what about level 1 of the quest?] */
|
||||
return (boolean) (!Is_airlevel(lev) && !Is_waterlevel(lev));
|
||||
if (!(Is_astralevel(lev) || Is_firelevel(lev)
|
||||
|| Is_airlevel(lev) || Is_waterlevel(lev)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
boolean
|
||||
avoid_ceiling(d_level *lev)
|
||||
{
|
||||
/* The quest is challenging since parts of the level
|
||||
may have ceilings and other parts may not; Avoid
|
||||
the ambiguity there by testing with avoid_ceiling()
|
||||
and using alternative messaging that avoids the term
|
||||
ceiling altogether there */
|
||||
if (In_quest(lev) || !has_ceiling(lev))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char *
|
||||
ceiling(coordxy x, coordxy y)
|
||||
{
|
||||
struct rm *lev = &levl[x][y];
|
||||
const char *what;
|
||||
|
||||
/* other room types will no longer exist when we're interested --
|
||||
* see check_special_room()
|
||||
*/
|
||||
if (*in_rooms(x, y, VAULT))
|
||||
what = "vault's ceiling";
|
||||
else if (*in_rooms(x, y, TEMPLE))
|
||||
what = "temple's ceiling";
|
||||
else if (*in_rooms(x, y, SHOPBASE))
|
||||
what = "shop's ceiling";
|
||||
else if (Is_waterlevel(&u.uz))
|
||||
/* water plane has no surface; its air bubbles aren't below sky */
|
||||
what = "water above";
|
||||
else if (IS_AIR(lev->typ))
|
||||
what = "sky";
|
||||
else if (Is_firelevel(&u.uz))
|
||||
what = "flames above";
|
||||
else if (In_quest(&u.uz))
|
||||
/* just in case; try to avoid in caller if you can */
|
||||
what = "expanse above";
|
||||
else if (Underwater)
|
||||
what = "water's surface";
|
||||
else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz))
|
||||
|| IS_WALL(lev->typ) || IS_DOOR(lev->typ) || lev->typ == SDOOR)
|
||||
what = "ceiling";
|
||||
else
|
||||
what = "rock cavern";
|
||||
|
||||
return what;
|
||||
}
|
||||
|
||||
const char *
|
||||
surface(coordxy x, coordxy y)
|
||||
{
|
||||
struct rm *lev = &levl[x][y];
|
||||
|
||||
if (u_at(x, y) && u.uswallow && is_animal(u.ustuck->data))
|
||||
/* 'husk' is iffy but maw is wrong for 't' class */
|
||||
return digests(u.ustuck->data) ? "maw"
|
||||
: enfolds(u.ustuck->data) ? "husk"
|
||||
: "nonesuch"; /* can't happen (fingers crossed...) */
|
||||
else if (IS_AIR(lev->typ) && Is_airlevel(&u.uz))
|
||||
return "air";
|
||||
else if (is_pool(x, y))
|
||||
return (Underwater && !Is_waterlevel(&u.uz))
|
||||
? "bottom" : hliquid("water");
|
||||
else if (is_ice(x, y))
|
||||
return "ice";
|
||||
else if (is_lava(x, y))
|
||||
return hliquid("lava");
|
||||
else if (lev->typ == DRAWBRIDGE_DOWN)
|
||||
return "bridge";
|
||||
else if (IS_ALTAR(levl[x][y].typ))
|
||||
return "altar";
|
||||
else if (IS_GRAVE(levl[x][y].typ))
|
||||
return "headstone";
|
||||
else if (IS_FOUNTAIN(levl[x][y].typ))
|
||||
return "fountain";
|
||||
else if (On_stairs(x, y))
|
||||
return "stairs";
|
||||
else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz))
|
||||
|| IS_WALL(lev->typ) || IS_DOOR(lev->typ) || lev->typ == SDOOR)
|
||||
return "floor";
|
||||
else
|
||||
return "ground";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user