called when saving with FREEING flag set has just discarded inventory */
| 185 | |
| 186 | /* called when saving with FREEING flag set has just discarded inventory */ |
| 187 | void |
| 188 | allunworn(void) |
| 189 | { |
| 190 | const struct worn *wp; |
| 191 | |
| 192 | u.twoweap = 0; /* uwep and uswapwep are going away */ |
| 193 | /* remove stale pointers; called after the objects have been freed |
| 194 | (without first being unworn) while saving invent during game save; |
| 195 | note: uball and uchain might not be freed yet but we clear them |
| 196 | here anyway (savegamestate() and its callers deal with them) */ |
| 197 | for (wp = worn; wp->w_mask; wp++) { |
| 198 | /* object is already gone so we don't/can't update is owornmask */ |
| 199 | *(wp->w_obj) = (struct obj *) 0; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | |
| 204 | /* return item worn in slot indicated by wornmask; needed by poly_obj() */ |