delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/09/21:04:08

Date: Thu, 10 Jul 1997 13:06:13 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
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
References: <ED2A6G DOT 2x9 AT nonexistent DOT com>

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 <mikmod.h>.....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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019