On Sat, 29 Nov 1997, ;P wrote: >char *find_causer_name(void *causer) >{ > > if (!causer) > return "None"; > else if (causer_is_char) > return GET_NAME(ch); return GET_NAME((struct char_data *)causer); > else if (causer_is_obj) > return obj->short_description; return ((struct obj_data *)causer)->short_description; > else > return "Unknown"; >but i can't think of how to determine whether its an object or char..uh.. >any ideas? Easiest would be to pass a flag (integer) to the function.... (ie: byte type) The other option is to add an integer as the first variable of every structure and then test the value of that common variable to determine what it is. Note that casting an object to be a character or vice versa is very bad. -- George Greer - Me@Null.net | Genius may have its limitations, but stupidity http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard +------------------------------------------------------------+ | 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