justinhj/astar-algorithm-cpp

Why is this 9 setted here

feroldi opened this issue · 3 comments

Why is this return 9 there?

int GetMap( int x, int y )
{
    if( x < 0 ||
         x >= MAP_WIDTH ||
         y < 0 ||
         y >= MAP_HEIGHT
         )
    {
        return 9;
    }
    return world_map[(y*MAP_WIDTH)+x];
}

It would be nice if I request a GetMap(8, 0) and the algorithm ignore it.

I treat the boundaries as the map as impassable so it doesn't try to move there. This is just an example though, you can change it for your own purposes.

Oh, thanks, by the way.

Thanks for your interest in this project