* Look for o_id on all lists but billobj. Return obj or NULL if not found. * Its OK for restore_timers() to call this function, there should not * be any timeouts on the gb.billobjs chain. */
| 2774 | * be any timeouts on the gb.billobjs chain. |
| 2775 | */ |
| 2776 | struct obj * |
| 2777 | find_oid(unsigned int id) |
| 2778 | { |
| 2779 | struct obj *obj; |
| 2780 | struct monst *mon, *mmtmp[3]; |
| 2781 | int i; |
| 2782 | |
| 2783 | /* first check various obj lists directly */ |
| 2784 | if ((obj = o_on(id, gi.invent)) != 0) |
| 2785 | return obj; |
| 2786 | if ((obj = o_on(id, fobj)) != 0) |
| 2787 | return obj; |
| 2788 | if ((obj = o_on(id, svl.level.buriedobjlist)) != 0) |
| 2789 | return obj; |
| 2790 | if ((obj = o_on(id, gm.migrating_objs)) != 0) |
| 2791 | return obj; |
| 2792 | |
| 2793 | /* not found yet; check inventory for members of various monst lists */ |
| 2794 | mmtmp[0] = fmon; |
| 2795 | mmtmp[1] = gm.migrating_mons; |
| 2796 | mmtmp[2] = gm.mydogs; /* for use during level changes */ |
| 2797 | for (i = 0; i < 3; i++) |
| 2798 | for (mon = mmtmp[i]; mon; mon = mon->nmon) |
| 2799 | if ((obj = o_on(id, mon->minvent)) != 0) |
| 2800 | return obj; |
| 2801 | |
| 2802 | /* not found at all */ |
| 2803 | return (struct obj *) 0; |
| 2804 | } |
| 2805 | |
| 2806 | /* Returns the price of an arbitrary item in the shop, |
| 2807 | 0 if the item doesn't belong to a shopkeeper or hero is not in the shop. */ |
no test coverage detected