[NEWBIE][CODE]absolute room location of an object

From: Mundi King (kingmundi@yahoo.com)
Date: 12/28/98


i wanted to make a function that mimics
print_object_location, but returns the information
of the room that the object is in

sh_int where_is_object (struct obj_data *obj)
{
if (obj->in_room > NOWHERE)
  return (obj->in_room);
else if (obj->carried_by)
  return (obj->carried_by->in_room);
else if (obj->worn_by)
  return (obj->worn_by->in_room);
else if (obj->in_obj)
  where_is_object (obj->in_obj);
  else
  {
        log("Object in an unkown location.");
                return (-1);
  }
}

my concern is that i have missed some
possibilities, is it possible for a character
to exist in the game but not in a room?
comments, critique?


_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST