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

Function figurine_location_checks

src/apply.c:2510–2541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2508}
2509
2510staticfn boolean
2511figurine_location_checks(struct obj *obj, coord *cc, boolean quietly)
2512{
2513 coordxy x, y;
2514
2515 if (carried(obj) && u.uswallow) {
2516 if (!quietly)
2517 You("don't have enough room in here.");
2518 return FALSE;
2519 }
2520 x = cc ? cc->x : u.ux;
2521 y = cc ? cc->y : u.uy;
2522 if (!isok(x, y)) {
2523 if (!quietly)
2524 You("cannot put the figurine there.");
2525 return FALSE;
2526 }
2527 if (IS_OBSTRUCTED(levl[x][y].typ)
2528 && !(passes_walls(&mons[obj->corpsenm]) && may_passwall(x, y))) {
2529 if (!quietly)
2530 You("cannot place a figurine in %s!",
2531 IS_TREE(levl[x][y].typ) ? "a tree" : "solid rock");
2532 return FALSE;
2533 }
2534 if (sobj_at(BOULDER, x, y) && !passes_walls(&mons[obj->corpsenm])
2535 && !throws_rocks(&mons[obj->corpsenm])) {
2536 if (!quietly)
2537 You("cannot fit the figurine on the boulder.");
2538 return FALSE;
2539 }
2540 return TRUE;
2541}
2542
2543staticfn int
2544use_figurine(struct obj **optr)

Callers 2

fig_transformFunction · 0.85
use_figurineFunction · 0.85

Calls 4

YouFunction · 0.85
isokFunction · 0.85
may_passwallFunction · 0.85
sobj_atFunction · 0.85

Tested by

no test coverage detected