Date: Thu, 10 Jul 1997 13:06:13 +0000 From: Bill Currie Subject: Re: A* Algorithm Problems SIGSEGV To: MReiferson AT aol DOT com Cc: djgpp AT delorie DOT com Reply-to: billc AT blackmagic DOT tait DOT co DOT nz Message-id: <33C4DE45.398C@blackmagic.tait.co.nz> Organization: Tait Electronics NZ MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit References: Precedence: bulk Matt Reiferson wrote: > > This A* Pathfinding algorithm I am planning to use in a Warcraft II > type game, the problem is, it doesn't work.......Sometimes I will be > able to find the paths but sometimes it gives me SIGSEGV crash > messages.....NOTE, this program that follows is just a program that > allows you to place blockades, a start and an end position to find the > fastest route from one point to another around those obstacles, it > uses allegro for the graphics, and a specialized version of MikMod, > because of this you will be unable to recompile the code without > removing the #include .....The line that is faulty (claimed > by symify is highlighted RED) Here is the symify output: [snip] > struct NODE *CheckCLOSED(int tilenum) > { > struct NODE *tmp; > > tmp=CLOSED->NextNode; > > while (tmp != NULL) > { > if (tmp->NodeNum == tilenum) <- line in question > return (tmp); > else > tmp=tmp->NextNode; > } > return (NULL); > } Are CLOSED and CLOSED->NextNode valid pointers? If you're running under w95, you won't notice if CLOSED is null until you start using it's garbage data. Another possibility is that CLOSED or *CLOSED is getting corrupted elsewhere in your program. Bill -- Leave others their otherness.