// If the list is empty (because quest_first is null) , set
// the new node to be the first quest node.
if(!ch->quest_first )
ch->quest_first = quest;
for ( q = ch->quests; q != NULL; q = q->next )
void quest_from_char (CHAR_DATA *ch, QUEST_DATA *q)
{
// check if it's at the top o' the list
if (ch->quests == q)
{
ch->quests = q->next;
}
else // if not iterate
{
QUEST_DATA *prev;
for (prev = ch->quests; prev != NULL; prev = prev->next)
{
if (prev->next == q)
{
// hop to q->next, skipping q and removing from list
prev->next = q->next;
break;
}
}
if (prev == NULL)
bug ("quest_from_char: quest not in list.", 0);
}
}
On the first iteration?
Sorry if im not getting my point across.