MCPcopy Create free account
hub / github.com/NetHack/NetHack / in_town

Function in_town

src/hack.c:3563–3585  ·  view source on GitHub ↗

is (x,y) in a town? */

Source from the content-addressed store, hash-verified

3561
3562/* is (x,y) in a town? */
3563boolean
3564in_town(coordxy x, coordxy y)
3565{
3566 struct mkroom *sroom;
3567 boolean has_subrooms = FALSE;
3568
3569 if (!svl.level.flags.has_town)
3570 return FALSE;
3571
3572 /*
3573 * See if (x,y) is in a room with subrooms, if so, assume it's the
3574 * town. If there are no subrooms, the whole level is in town.
3575 */
3576 for (sroom = &svr.rooms[0]; sroom->hx > 0; sroom++) {
3577 if (sroom->nsubrooms > 0) {
3578 has_subrooms = TRUE;
3579 if (inside_room(sroom, x, y))
3580 return TRUE;
3581 }
3582 }
3583
3584 return !has_subrooms;
3585}
3586
3587staticfn void
3588move_update(boolean newlev)

Callers 12

still_chewingFunction · 0.85
check_special_roomFunction · 0.85
digFunction · 0.85
watch_digFunction · 0.85
mdig_tunnelFunction · 0.85
zap_digFunction · 0.85
is_izchakFunction · 0.85
set_mimic_symFunction · 0.85
watch_on_dutyFunction · 0.85
kick_doorFunction · 0.85
dryupFunction · 0.85
dipfountainFunction · 0.85

Calls 1

inside_roomFunction · 0.85

Tested by

no test coverage detected