summaryrefslogtreecommitdiff
path: root/src/pathfind.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-24 15:18:25 +0000
committerrubidium <rubidium@openttd.org>2009-07-24 15:18:25 +0000
commitc3d2c47faa6bb9c07c362127b4fb5de79130bfa0 (patch)
tree6478960a00fd8d58956b9fdb0981ad1bf995f373 /src/pathfind.h
parentcf38a5bee6628f4be58a1bd7774658cf86807d5c (diff)
downloadopenttd-c3d2c47faa6bb9c07c362127b4fb5de79130bfa0.tar.xz
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
Diffstat (limited to 'src/pathfind.h')
-rw-r--r--src/pathfind.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pathfind.h b/src/pathfind.h
index db758f0a6..c3f28cb67 100644
--- a/src/pathfind.h
+++ b/src/pathfind.h
@@ -7,6 +7,7 @@
#include "direction_type.h"
#include "station_base.h"
+#include "waypoint_base.h"
enum {
STR_FACTOR = 2,
@@ -89,7 +90,10 @@ void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagD
*/
static inline TileIndex CalcClosestStationTile(StationID station, TileIndex tile)
{
- const Station *st = Station::Get(station);
+ const BaseStation *bst = BaseStation::Get(station);
+ if (Waypoint::IsExpected(bst)) return bst->xy;
+
+ const Station *st = Station::From(bst);
/* If the rail station is (temporarily) not present, use the station sign to drive near the station */
if (st->train_tile == INVALID_TILE) return st->xy;