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

Function init_shop_selection

src/shknam.c:359–374  ·  view source on GitHub ↗

validate shop probabilities; otherwise incorrect local changes could end up provoking infinite loops or wild subscripts fetching garbage */

Source from the content-addressed store, hash-verified

357/* validate shop probabilities; otherwise incorrect local changes could
358 end up provoking infinite loops or wild subscripts fetching garbage */
359void
360init_shop_selection()
361{
362 int i, j, item_prob, shop_prob;
363
364 for (shop_prob = 0, i = 0; i < SIZE(shtypes); i++) {
365 shop_prob += shtypes[i].prob;
366 for (item_prob = 0, j = 0; j < SIZE(shtypes[0].iprobs); j++)
367 item_prob += shtypes[i].iprobs[j].iprob;
368 if (item_prob != 100)
369 panic("item probabilities total to %d for %s shops!",
370 item_prob, shtypes[i].name);
371 }
372 if (shop_prob != 100)
373 panic("shop probabilities total to %d!", shop_prob);
374}
375#endif /*0*/
376
377/* decide whether an object or object type is considered vegetarian;

Callers

nothing calls this directly

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected