"Cameron Barry" <[EMAIL PROTECTED]> wrote:

> Another silly question (thanks Bobby for solving my last one!!)...
> 
> I'm getting a Seg Fault in the following code:
> 
> if (!IS_NPC(ch))
> {
>     for (i=ch->in_room->track_num; i <= MAX_TRACK_INROOM; i++)

  Okay, I'm assumeing that 'ch->in_room->track_num' is the number of
entries in "track_num" And that "MAX_TRACK_INROOM" Is the max enteries
allowed in the array "ch->in_room->track".  Could you give us
information about the track fields please?  Since I'm not sure in what
direction the table is suppoed to be filled.

>     {
>         if (i == ch->in_room->track_num)
>         {

  Alright so only for this entery you want to do the following.

>          ch->in_room->track[i]->name = ch->name;    /* <--- THIS LINE
>          */       ch->in_room->track[i]->dir  = door;
>                 ch->in_room->track[i]->timer = timer;

  So dir and timer are just ints.  Can we see your definition of
"ROOM_INDEX_DATA"?  I think that'll help. 
>                      if (ch->in_room->track_num >= MAX_TRACK_INROOM)
>                      {
>                          ch->in_room->track_num = 0;
>                      }
>                      else
>                      {
>                          ch->in_room->track_num += 1;
>                      }
>         }
>     }
> }


  You know the more I look at this, the more confused I am, What's the
purpose of this function, To keep some circular list of names, what door
they took and at what time they exited that door or something?

  My first guess is, Your going outside the bounds of your array with 

>     for (i=ch->in_room->track_num; i <= MAX_TRACK_INROOM; i++)

  since you MAY want it.

>     for (i=ch->in_room->track_num; i < MAX_TRACK_INROOM; i++)

  But I need to see the actual define myself.  If it's
MAX_TRACK_INROOM+1, then ya, the equal sign works.  But I don't know
about others, I need more info.

  Tony
  Tony

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Reply via email to