* Return the object's physical location. This only makes sense for * objects that are currently on the level (i.e. migrating objects * are nowhere). By default, only things that can be seen (in hero's * inventory, monster's inventory, or on the ground) are reported. * By adding BURIED_TOO and/or CONTAINED_TOO flags, you can also get * the location of buried and contained objects. Note that
| 651 | * is not available or subject to the constraints above. |
| 652 | */ |
| 653 | boolean |
| 654 | get_obj_location( |
| 655 | struct obj *obj, |
| 656 | coordxy *xp, coordxy *yp, |
| 657 | int locflags) |
| 658 | { |
| 659 | switch (obj->where) { |
| 660 | case OBJ_INVENT: |
| 661 | *xp = u.ux; |
| 662 | *yp = u.uy; |
| 663 | return TRUE; |
| 664 | case OBJ_FLOOR: |
| 665 | *xp = obj->ox; |
| 666 | *yp = obj->oy; |
| 667 | return TRUE; |
| 668 | case OBJ_MINVENT: |
| 669 | if (obj->ocarry->mx) { |
| 670 | *xp = obj->ocarry->mx; |
| 671 | *yp = obj->ocarry->my; |
| 672 | return TRUE; |
| 673 | } |
| 674 | break; /* !mx => migrating monster */ |
| 675 | case OBJ_BURIED: |
| 676 | if (locflags & BURIED_TOO) { |
| 677 | *xp = obj->ox; |
| 678 | *yp = obj->oy; |
| 679 | return TRUE; |
| 680 | } |
| 681 | break; |
| 682 | case OBJ_CONTAINED: |
| 683 | if (locflags & CONTAINED_TOO) |
| 684 | return get_obj_location(obj->ocontainer, xp, yp, locflags); |
| 685 | break; |
| 686 | } |
| 687 | *xp = *yp = 0; |
| 688 | return FALSE; |
| 689 | } |
| 690 | |
| 691 | boolean |
| 692 | get_mon_location( |
no outgoing calls
no test coverage detected