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

Function deserted_shop

src/shk.c:722–747  ·  view source on GitHub ↗

give a message when entering an untended shop (caller has verified that) */

Source from the content-addressed store, hash-verified

720
721/* give a message when entering an untended shop (caller has verified that) */
722staticfn void
723deserted_shop(/*const*/ char *enterstring)
724{
725 struct monst *mtmp;
726 struct mkroom *r = &svr.rooms[(int) *enterstring - ROOMOFFSET];
727 int x, y, m = 0, n = 0;
728
729 for (x = r->lx; x <= r->hx; ++x)
730 for (y = r->ly; y <= r->hy; ++y) {
731 if (u_at(x, y))
732 continue;
733 if ((mtmp = m_at(x, y)) != 0) {
734 ++n;
735 if (sensemon(mtmp) || ((M_AP_TYPE(mtmp) == M_AP_NOTHING
736 || M_AP_TYPE(mtmp) == M_AP_MONSTER)
737 && canseemon(mtmp)))
738 ++m;
739 }
740 }
741
742 if (Blind && !(Blind_telepat || Detect_monsters))
743 ++n; /* force feedback to be less specific */
744
745 pline("This shop %s %s.", (m < n) ? "seems to be" : "is",
746 !n ? "deserted" : "untended");
747}
748
749/* called from check_special_room(hack.c) */
750void

Callers 1

u_entered_shopFunction · 0.85

Calls 3

sensemonFunction · 0.85
canseemonFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected