invent gold sanity check; used by doorganize() to control how getobj() deals with gold and also by wizard mode sanity_check() */
| 4886 | /* invent gold sanity check; used by doorganize() to control how getobj() |
| 4887 | deals with gold and also by wizard mode sanity_check() */ |
| 4888 | boolean |
| 4889 | check_invent_gold(const char *why) /* 'why' == caller in case of warning */ |
| 4890 | { |
| 4891 | struct obj *otmp; |
| 4892 | int goldstacks = 0, wrongslot = 0; |
| 4893 | |
| 4894 | /* there should be at most one stack of gold in invent, in slot '$' */ |
| 4895 | for (otmp = gi.invent; otmp; otmp = otmp->nobj) |
| 4896 | if (otmp->oclass == COIN_CLASS) { |
| 4897 | ++goldstacks; |
| 4898 | if (otmp->invlet != GOLD_SYM) |
| 4899 | ++wrongslot; |
| 4900 | } |
| 4901 | |
| 4902 | if (goldstacks > 1 || wrongslot > 0) { |
| 4903 | impossible("%s: %s%s%s", why, |
| 4904 | (wrongslot > 1) ? "gold in wrong slots" |
| 4905 | : (wrongslot > 0) ? "gold in wrong slot" |
| 4906 | : "", |
| 4907 | (wrongslot > 0 && goldstacks > 1) ? " and " : "", |
| 4908 | (goldstacks > 1) ? "multiple gold stacks" : ""); |
| 4909 | return TRUE; /* gold can be #adjusted */ |
| 4910 | } |
| 4911 | |
| 4912 | return FALSE; /* gold can't be #adjusted */ |
| 4913 | } |
| 4914 | |
| 4915 | /* normal getobj callback for item to #adjust; excludes gold */ |
| 4916 | staticfn int |
no test coverage detected