summaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-11-17 23:01:58 +0000
committerbelugas <belugas@openttd.org>2006-11-17 23:01:58 +0000
commitc26dc76a7d40884c5f57014cecff5e4aff3261ba (patch)
treecb862a03cf34020ff230c133372a4be330d3a917 /map.h
parentbd129cf6bf59d62896fec327a3b5677f74bbb606 (diff)
downloadopenttd-c26dc76a7d40884c5f57014cecff5e4aff3261ba.tar.xz
(svn r7198) -Codechange: Implement a circular tile search function.
Just provide the number of tiles per side, a pointer to a test function, the tile to start searching and voila. Fixes [FS#364] by removing a lengthy and suboptimal random search pattern. Thanks Rubidium.
Diffstat (limited to 'map.h')
-rw-r--r--map.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/map.h b/map.h
index 661515edd..25e29ef06 100644
--- a/map.h
+++ b/map.h
@@ -176,6 +176,9 @@ static inline TileIndexDiff TileOffsByDir(uint dir)
return ToTileIndexDiff(_tileoffs_by_dir[dir]);
}
+typedef bool TestTileOnSearchProc(TileIndex tile, uint32 data);
+bool CircularTileSearch(TileIndex tile, uint size, TestTileOnSearchProc proc, uint32 data);
+
/* Approximation of the length of a straight track, relative to a diagonal
* track (ie the size of a tile side). #defined instead of const so it can
* stay integer. (no runtime float operations) Is this needed?