Finding Type of a Void Pointer

From: ;P (siv@CYBERENET.NET)
Date: 11/29/97


hello...i'm trying to write a command that will list the events for my
mud, but i'm running into a spot of trouble...basically, my event
structure looks like:

struct event_info {
  EVENT(*func);
  void *event_information;
  void *causer;
  struct queue *q;
};

now, i use the causer pointer to refer to objects and characters so that
i can remove the events associated with them when the char or obj is
extracted..in the list event command, i'm trying to give the name of the
character or object that is associated with that event..so that it will
look like:

1. Siv - Regeneration (4 Secs)
2. Siv - Remove Affect (ch) (23 Secs)
3. the sharp dagger - Remove Affect (obj) (34 Secs)
4. None - Remove Affect (room) (125 Secs)

the only problem that i'm having is getting the name or short description
of the causer..i'm trying to use a function like

char *find_causer_name(void *causer)
{

 if (!causer)
   return "None";
 else if (causer_is_char)
   return GET_NAME(ch);
 else if (causer_is_obj)
   return obj->short_description;
 else
   return "Unknown";
}

but i can't think of how to determine whether its an object or char..uh..
any ideas?

siv


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



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