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

Function mkshobj_at

src/shknam.c:453–483  ·  view source on GitHub ↗

make an object of the appropriate type for a shop square */

Source from the content-addressed store, hash-verified

451
452/* make an object of the appropriate type for a shop square */
453staticfn void
454mkshobj_at(const struct shclass *shp, int sx, int sy, boolean mkspecl)
455{
456 struct monst *mtmp;
457 struct permonst *ptr;
458 int atype;
459
460 /* 3.6 tribute */
461 if (mkspecl && (!strcmp(shp->name, "rare books")
462 || !strcmp(shp->name, "second-hand bookstore"))) {
463 struct obj *novel = mksobj_at(SPE_NOVEL, sx, sy, FALSE, FALSE);
464
465 if (novel)
466 svc.context.tribute.bookstock = TRUE;
467 return;
468 }
469
470 if (rn2(100) < depth(&u.uz) && !MON_AT(sx, sy)
471 && (ptr = mkclass(S_MIMIC, 0)) != 0
472 && (mtmp = makemon(ptr, sx, sy, NO_MM_FLAGS)) != 0) {
473 /* nothing */
474 } else {
475 atype = get_shop_item((int) (shp - shtypes));
476 if (atype == VEGETARIAN_CLASS)
477 mkveggy_at(sx, sy);
478 else if (atype < 0)
479 (void) mksobj_at(-atype, sx, sy, TRUE, TRUE);
480 else
481 (void) mkobj_at(atype, sx, sy, TRUE);
482 }
483}
484
485/* extract a shopkeeper name for the given shop type */
486staticfn void

Callers 1

stock_roomFunction · 0.85

Calls 8

mksobj_atFunction · 0.85
rn2Function · 0.85
depthFunction · 0.85
mkclassFunction · 0.85
makemonFunction · 0.85
get_shop_itemFunction · 0.85
mkveggy_atFunction · 0.85
mkobj_atFunction · 0.85

Tested by

no test coverage detected