(svn r2635) Fix: [ntp/misc] Improve the old pathfinder. Changed it to A* instead of Dijkstra.

- Benchmark shows that NTP is now around 10x faster than NPF.
  - Made IsTunnelTile macro to determine if a tile is a tunnel.
  - Added some useful debugging functions for making tiles red / getting accurate timestamps.
  - Remove old depot finding algorithm.
  - Disable warning for signed/unsigned comparisons.
This commit is contained in:
ludde
2005-07-19 11:42:40 +00:00
parent 29f6ada06a
commit 3e97dda275
13 changed files with 340 additions and 286 deletions

7
tile.h
View File

@@ -15,7 +15,7 @@ typedef enum TileTypes {
MP_VOID, // invisible tiles at the SW and SE border
MP_INDUSTRY,
MP_TUNNELBRIDGE,
MP_UNMOVABLE
MP_UNMOVABLE,
} TileType;
/* Direction as commonly used in v->direction, 8 way. */
@@ -95,6 +95,11 @@ static inline bool IsTileType(TileIndex tile, TileType type)
return GetTileType(tile) == type;
}
static inline bool IsTunnelTile(TileIndex tile)
{
return IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xF0) == 0;
}
static inline Owner GetTileOwner(TileIndex tile)
{
assert(tile < MapSize());