Strings...

From: blah (merren@MINDCRYME.COM)
Date: 02/19/98


I've implemented "morphing" commands into my mud (currently just for
Gods). And I realize I may have a real clunky way of doing things, but
hey, it works. Anywho...

I've added a few things to char_special_data:

   char *mname;
   char *mshort_descr;
   char *mlong_descr;
   char *mdescription;

Etc... Basically I use str_dup to set those strings to whatever the player
is "morphed" to. Now, for gods I have "unmorph" which clears these strings
and turns them back to "normal" and this is what I have in the unmorph
function:

 vict->char_specials.mname = NULL;
 vict->char_specials.mshort_descr = NULL;
 vict->char_specials.mlong_descr = NULL;
 vict->char_specials.mdescription = NULL;
 vict->char_specials.msex = NULL;

Among other things... Anyways... Works fine:

5000/5000h [none] > morph avatar pig
Avatar is suddenly turned into a messy pig!

5000/5000h [none] > unmorph pig
A messy pig suddenly screams in pain and changes into Avatar!

(Also changes long_descr, description, sex, and some other things *grin*)

Here's the question:

What about those strings I'm using, don't they need to be free()'d
somewhere? If so, where would I do this, just in free_char() in db.c?

Thanks...

Melen
Allanthya.org port 4000


     +------------------------------------------------------------+
     | 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/15/00 PST