1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-29 09:29:10 +00:00

(svn r24353) -Fix [FS#5215] (r23506): [NoAI] A TileIndex isn't a station id, so don't use it as one.

This commit is contained in:
michi_cc
2012-06-23 15:02:20 +00:00
parent 9208059e3e
commit ef394916c9

View File

@@ -659,8 +659,8 @@ static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance)
/* static */ uint ScriptOrder::GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile)
{
if (vehicle_type == ScriptVehicle::VT_AIR) {
if (ScriptTile::IsStationTile(origin_tile) && ::Station::Get(origin_tile)->airport.tile != INVALID_TILE) origin_tile = ::Station::Get(origin_tile)->airport.tile;
if (ScriptTile::IsStationTile(dest_tile) && ::Station::Get(dest_tile)->airport.tile != INVALID_TILE) dest_tile = ::Station::Get(dest_tile)->airport.tile;
if (ScriptTile::IsStationTile(origin_tile) && ::Station::GetByTile(origin_tile)->airport.tile != INVALID_TILE) origin_tile = ::Station::GetByTile(origin_tile)->airport.tile;
if (ScriptTile::IsStationTile(dest_tile) && ::Station::GetByTile(dest_tile)->airport.tile != INVALID_TILE) dest_tile = ::Station::GetByTile(dest_tile)->airport.tile;
return ScriptMap::DistanceSquare(origin_tile, dest_tile);
} else {