Yes, you were on the right track in the beginning... it should be in
recycle.c... there should be an affect_free, free_affect, and
new_affect... affect_free is basically just a linked list of any affect
memory slots that have been previously freed, like so:
Declare 3 new affects on a character, say they spell themselves up...
someone comes along and cancels them and they lose the 3 spells... the
code frees all the strings and whatnot that were assigned to those
affects, and adds them one by one to the affect_free list, because the
memory's already been allocated for those, so it can save itself a step
the next time an affect is called for... when the character respells
him/herself up, this time with 5 spells, the code checks to see if
anything is in the affect_free list, if it is, it just uses those memory
slots one by one until it runs out of them (at the 3rd spell), then it
allocates 2 new chunks of memory for the 2 extra spells that were
cast... the next time that char gets canceled, the code frees the
strings and whatnot of those spells and throws all 5 of them into the
affect_free list...
Now, that's all affect_free is, a pointer to that list... where the
affect structures themselves are initialized and destroyed at are the
new_affect and free_affect functions that should be right below the
affect_free declaration... within new_affect, you should find where
strings are initialized to &str_empty[0] or str_dup(""), and integers
may be initialized to 0 or whatever... within free_affect, you'll find
things like free_string(whatever->field)... so that's where you'll need
to look...
Richard Lindsey
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, December 27, 2004 2:50 PM
To: [email protected]
Subject: AFFECT_DATA
Ok, another fast question!
I have added a new field to the AFFECT_DATA structure but I cannot seem
to see
where it is allocated so I can free the new field? I checked in
recycle.c and
mem.c and there isn't anything there expect affect_free and I am not
sure what
this is. I grepped for type and I've looked through the files that
should have
this but I can't seem to find any. I don't want to go through EVERY
single
spell and add the line to make the new field to be set to whatever I
want. I
know there is another way and just can't find it.
Could someone explain this to me?
THANKS!
--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom