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

Function get_shop_item

src/shknam.c:828–839  ·  view source on GitHub ↗

positive value: class; negative value: specific object type. can also return non-existing object class (eg. VEGETARIAN_CLASS) */

Source from the content-addressed store, hash-verified

826/* positive value: class; negative value: specific object type.
827 can also return non-existing object class (eg. VEGETARIAN_CLASS) */
828int
829get_shop_item(int type)
830{
831 const struct shclass *shp = shtypes + type;
832 int i, j;
833
834 /* select an appropriate object type at random */
835 for (j = rnd(100), i = 0; (j -= shp->iprobs[i].iprob) > 0; i++)
836 continue;
837
838 return shp->iprobs[i].itype;
839}
840
841/* version of shkname() for beginning of sentence */
842char *

Callers 2

mkshobj_atFunction · 0.85
set_mimic_symFunction · 0.85

Calls 1

rndFunction · 0.85

Tested by

no test coverage detected