Pointers and obj_proto

From: Akuma/Chris Baggett/DOOMer (doomer@BAYOU.COM)
Date: 10/09/97


ok, i was creating a restring function for my mud,
and i kept having trouble with it crashing after
restringing a newly loaded object, and doing a
look_at_char().

Anyway, i looked through the code and saw
that in read_object (or create_obj() i don't remember)
there's this line

*obj = obj_proto[i];

well, i then realized that when i was doing a
FREE(GET_OBJ_SHORT(obj));
that it was free()ing the obj_proto's Short Desc.
that's what was causing my mud to crash.

well anyway, my question is this:
How can i do an if() check to see if
GET_OBJ_SHORT(obj) != GET_OBJ_SHORT(obj_proto[i])
i know it's not that easy, and its not as easy as a strcmp()
b/c someone could have restring'd it with the EXACT same short_descr
and then that would just be memory wasted.

i had tried something to the effect of:
(assuming  obj's RNUM != -1)
if (&(GET_OBJ_SHORT(obj)) != &(obj_proto[GET_OBJ_RNUM(obj)].short_descr))

GET_OBJ_SHORT(obj) is just a simple define
#define GET_OBJ_SHORT(obj) ((obj)->short_descr)

if anyone has any ideas, they would be appreciated.
i don't wanna be doing this kinda thing much.
i KNOW i could possibly just create() a new obj after
extracting the old one, and copying all the strings,etc.
but i figured THIS way would be a bit easier.

i would appreciate any help on this,
i figured out my last post's problem on my on (after a bit of sleep)

thnx again.
Akuma the Raging Coder

  +------------------------------------------------------------+
  | "The poets talk about love, but what I talk about is DOOM, |
  |      because in the end, DOOM is all that counts." -       |
  |   Alex Machine/George Stark/Stephen King, The Dark Half    |
  |        "Nothing is IMPOSSIBLE, Just IMPROBABLE"            |
  |   "Easier Said Than Done, But Better Done Than Said..."    |
  +------------------------------------------------------------+


     +------------------------------------------------------------+
     | 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