(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

This commit is contained in:
rubidium
2009-07-24 15:18:25 +00:00
parent 196856f54e
commit eacc809fa4
10 changed files with 50 additions and 44 deletions

View File

@@ -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;