I actually did something that worked without using REMOVE_FROM_LIST, don't
really know if its the "proper" way of doing this, or the safest but it work
regardless:
ACMD(do_forget)
{
int spell, i;
struct SpellMemData *smd;
skip_spaces(&argument);
spell = find_spell_num(argument);
if (!*argument) {
send_to_char("Syntax: Forget <spell> | all\r\n", ch);
return;
} else if (!str_cmp(argument, "all")) {
for (i = 1; i <= MAX_SPELLS; i++) {
if (GET_SPELL(ch, i) > 0)
GET_SPELL(ch, i) = 0;
}
ch->MemList = NULL;
send_to_char("You forget everything!\r\n", ch);
return;
} else if ((spell < 1) || (spell > MAX_SPELLS)) {
send_to_char("You don't have that spell memorized.\r\n", ch);
return;
} else {
// here below...
for (smd = ch->MemList; smd; smd = smd->next)
if (spell == smd->spell) {
sprintf(BufOne, "You purge '%s' from your thoughts.\r\n",
spell_info[spell].name);
send_to_char(BufOne, ch);
DeleteMemorieSpell(ch, smd);
return;
}
// stop example...
if (GET_SPELL(ch, spell) > 0) {
sprintf(BufOne, "You purge '%s' from your thoughts.\r\n",
spell_info[spell].name);
send_to_char(BufOne, ch);
GET_SPELL(ch, spell)--;
return;
} else
send_to_char("You don't have that spell memorized.\r\n", ch);
}
}
its pretty fail safe, works great too. See anything that maybe be an issue?
leak or the likes?
Thanks,
Dave
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT