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

Function shkgone

src/shk.c:234–269  ·  view source on GitHub ↗

called in mon.c */

Source from the content-addressed store, hash-verified

232
233/* called in mon.c */
234void
235shkgone(struct monst *mtmp)
236{
237 struct eshk *eshk = ESHK(mtmp);
238 struct mkroom *sroom = &svr.rooms[eshk->shoproom - ROOMOFFSET];
239 struct obj *otmp;
240 char *p;
241 int sx, sy;
242
243 /* [BUG: some of this should be done on the shop level */
244 /* even when the shk dies on a different level.] */
245 if (on_level(&eshk->shoplevel, &u.uz)) {
246 discard_damage_owned_by(mtmp);
247 sroom->resident = (struct monst *) 0;
248 if (!search_special(ANY_SHOP))
249 svl.level.flags.has_shop = 0;
250
251 /* items on shop floor revert to ordinary objects */
252 for (sx = sroom->lx; sx <= sroom->hx; sx++)
253 for (sy = sroom->ly; sy <= sroom->hy; sy++)
254 for (otmp = svl.level.objects[sx][sy]; otmp;
255 otmp = otmp->nexthere)
256 otmp->no_charge = 0;
257
258 /* Make sure bill is set only when the
259 dead shk is the resident shk. */
260 if ((p = strchr(u.ushops, eshk->shoproom)) != 0) {
261 setpaid(mtmp);
262 eshk->bill_p = (struct bill_x *) 0;
263 /* remove eshk->shoproom from u.ushops */
264 do {
265 *p = *(p + 1);
266 } while (*++p);
267 }
268 }
269}
270
271void
272set_residency(struct monst *shkp, boolean zero_out)

Callers 1

m_detachFunction · 0.85

Calls 4

on_levelFunction · 0.85
discard_damage_owned_byFunction · 0.85
search_specialFunction · 0.85
setpaidFunction · 0.85

Tested by

no test coverage detected