1
0
Fork 0

Fix: [Script] Make ScriptOrder functions aware of road waypoints

Updated GetOrderTypeByTile and GetOrderDestination to support road waypoints.
pull/13419/head
SamuXarick 2025-01-31 17:41:57 +00:00
parent 5664b1e2f6
commit 3b4c2c9daf
1 changed files with 6 additions and 2 deletions

View File

@ -34,7 +34,7 @@ static OrderType GetOrderTypeByTile(TileIndex t)
switch (::GetTileType(t)) {
default: break;
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;
return OT_GOTO_STATION;
@ -287,8 +287,12 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
for (TileIndex t : wp->train_station) {
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;
}
default: return INVALID_TILE;