I have a game-map like this:
char terrain[MAP_SIZE][MAP_SIZE];
And need to perform fast "expanding" checks. Starting at a tile (x,y) i want to find the closest tile from the start-tile that has a certain value, and stopping directly when i find it. So i dont want to start at some distance from the start and do a 2D/nestled for() loop through ALL the tiles and check distance to the start-tile for each suitable tile.
Ties or diagonal distance can be ignored for optimization, so checking one "rectangular circle" at a time starting from the center is good enough. But how to do that efficiently? I might need a max-range so it stops after reaching the Nth "rectangular circle".
Thanks a lot!
Erik