validate shop probabilities; otherwise incorrect local changes could end up provoking infinite loops or wild subscripts fetching garbage */
| 357 | /* validate shop probabilities; otherwise incorrect local changes could |
| 358 | end up provoking infinite loops or wild subscripts fetching garbage */ |
| 359 | void |
| 360 | init_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; |