Re: GUILD related layout

From: Web Remedies Network (webremedies@home.com)
Date: 04/01/01


I wrote:

> > CASE("Trains") {
> >    int numbers[4];
> >    sscanf(value, "%d %d %d %d", numbers, numbers+1, numbers+2,
> > numbers+3) != 4
>

Peter wrote:

> Huh?!?  I think you meant to enclose that with an if () statement or
> something.  At any rate, you have a comparison that does nothing and
> you're missing a ; here.  Also, I always preferred using strtok()/atoi()
> to parse input lines.  It allows you to parse them a little at a time so
> you don't have to allocate an array like numbers[] to store the whole
> thing at once.

sorry that != 4 was not suppose to be there, I typed it in by accident
while posting.


> >    CREATE(new_train, struct trainer_data, 1);
> >    new_train->next = mob_proto[i].mob_specials.trainer;
> >    mob_proto[i].mob_specials.trainer->prev = new_train;
>
> I'm willing to bet that this is where your crash is.  What happens if
> mob_proto[i].mob_specials.trainer is NULL?  You just tried to dereference
> a NULL pointer which is a HUGE no-no.  BTW, why do you want a prev
> pointer anyways?

I'm willing to bet your right, might anyone know a work around or
sollution
to this problem?

> >    new_train->prev = NULL;
> >    mob_proto[i].mob_specials.trainer = new_train;

I can remove the prev pointer which is besides the fact, that I believe
you
are right in saing that I am trying to dereference a NULL pointer.

- Thanks
Bill

--
   +---------------------------------------------------------------+
   | 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