Re: Evaluation,and bounds checking with structures/linked lists.

From: Del (caminturn@earthlink.net)
Date: 04/06/01


Web Remedies Network wrote:
>
>   if(IS_TRAINER(OLC_MOB(d))) {

Here you check to see if the mob is a trainer. (see below for reason I mention
this)

>    sprintf(buf, "    &g[&w  Spell&g/&wSkill  &g]      [&wPercent
> Taught&g]
> [&wCost&g]     [&wQP Cost&g]\r\n");
>    send_to_char(buf, d->character);
>    for(temp = IS_TRAINER((OLC_MOB(d))), i = 0; temp; temp = temp->next,
> i++) {

Here you set temp = 0 or 1? (assuming you are just checking to see if it exists
above, and that your check returns 0 or 1)
Then in your loop ==>  i = 0;temp;temp = temp->next
(I may be slightly off) but the loop ends when you set temp = temp->next (what
ever next is)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST