mirror of https://github.com/OpenTTD/OpenTTD
Fix: [Script] Make ScriptOrder functions aware of road waypoints
Updated GetOrderTypeByTile and GetOrderDestination to support road waypoints.pull/13419/head
parent
5664b1e2f6
commit
3b4c2c9daf
|
@ -34,7 +34,7 @@ static OrderType GetOrderTypeByTile(TileIndex t)
|
||||||
switch (::GetTileType(t)) {
|
switch (::GetTileType(t)) {
|
||||||
default: break;
|
default: break;
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
if (IsBuoy(t) || IsRailWaypoint(t)) return OT_GOTO_WAYPOINT;
|
if (IsBuoy(t) || IsRailWaypoint(t) || IsRoadWaypoint(t)) return OT_GOTO_WAYPOINT;
|
||||||
if (IsHangar(t)) return OT_GOTO_DEPOT;
|
if (IsHangar(t)) return OT_GOTO_DEPOT;
|
||||||
return OT_GOTO_STATION;
|
return OT_GOTO_STATION;
|
||||||
|
|
||||||
|
@ -287,8 +287,12 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
|
||||||
for (TileIndex t : wp->train_station) {
|
for (TileIndex t : wp->train_station) {
|
||||||
if (wp->TileBelongsToRailStation(t)) return t;
|
if (wp->TileBelongsToRailStation(t)) return t;
|
||||||
}
|
}
|
||||||
|
} else if (wp->road_waypoint_area.tile != INVALID_TILE) {
|
||||||
|
for (TileIndex t : wp->road_waypoint_area) {
|
||||||
|
if (::IsRoadWaypointTile(t) && ::GetStationIndex(t) == wp->index) return t;
|
||||||
}
|
}
|
||||||
/* If the waypoint has no rail waypoint tiles, it must have a buoy */
|
}
|
||||||
|
/* If the waypoint has no rail or road waypoint tiles, it must have a buoy */
|
||||||
return wp->xy;
|
return wp->xy;
|
||||||
}
|
}
|
||||||
default: return INVALID_TILE;
|
default: return INVALID_TILE;
|
||||||
|
|
Loading…
Reference in New Issue