recursively search obj for an object in class oclass, return 1st found */
| 198 | |
| 199 | /* recursively search obj for an object in class oclass, return 1st found */ |
| 200 | struct obj * |
| 201 | o_in(struct obj *obj, char oclass) |
| 202 | { |
| 203 | struct obj *otmp; |
| 204 | struct obj *temp; |
| 205 | |
| 206 | if (obj->oclass == oclass) |
| 207 | return obj; |
| 208 | /* |
| 209 | * Note: we exclude SchroedingersBox because the corpse it contains |
| 210 | * isn't necessarily a corpse yet. Resolving the status would lead |
| 211 | * to complications if it turns out to be a live cat. We know that |
| 212 | * that Box can't contain anything else because putting something in |
| 213 | * would resolve the cat/corpse situation and convert to ordinary box. |
| 214 | */ |
| 215 | if (Has_contents(obj) && !SchroedingersBox(obj)) { |
| 216 | for (otmp = obj->cobj; otmp; otmp = otmp->nobj) |
| 217 | if (otmp->oclass == oclass) |
| 218 | return otmp; |
| 219 | else if (Has_contents(otmp) && (temp = o_in(otmp, oclass)) != 0) |
| 220 | return temp; |
| 221 | } |
| 222 | return (struct obj *) 0; |
| 223 | } |
| 224 | |
| 225 | /* Recursively search obj for an object made of specified material. |
| 226 | * Return first found. |
no outgoing calls
no test coverage detected