I am seriously confused on this. What I am trying to do is clear all of the
extra descriptions from an object. I can add any number of extra
descriptions to an object but when I try to clear them using this code it
always leaves the first one. I have seen this exact same method used in olc
delete functions and I cant for the life of me figure out why it leaves the
first one in the list. Btw, I also get output saying that it is clearing
the first extra description even though it remains after the clear.
Here is the code in question:
if (!str_cmp(command, "clear"))
{
EXTRA_DESCR_DATA *ed_next = NULL;
for (ed = pObj->extra_descr; ed; ed = ed_next)
{
ed_next = ed->next;
ptc(ch, Clearing exra description: %s\n\r, ed->keyword);
free_extra_descr(ed);
}
return TRUE;
}
I will also post the free_extra_descr function even though I believe it is
stock.
void free_extra_descr(EXTRA_DESCR_DATA * ed)
{
if (!IS_VALID(ed))
return;
free_string(ed->keyword);
free_string(ed->description);
INVALIDATE(ed);
ed->next = extra_descr_free;
extra_descr_free = ed;
}
If I am not mistaken clearing affects from objects would be done in a
similar way also, if I am mistaken about that then I would like to know how
that is done as well. I appreciate any and all help on this