Allow changing road vehicle driving side when all road vehicles in depots

This commit is contained in:
Jonathan G Rennison
2022-09-11 11:51:32 +01:00
parent a8d5e56696
commit 143230d8f2
2 changed files with 16 additions and 4 deletions

View File

@@ -180,14 +180,26 @@ RoadType AllocateRoadType(RoadTypeLabel label, RoadTramType rtt)
}
/**
* Verify whether a road vehicle is available.
* @return \c true if at least one road vehicle is available, \c false if not
* Verify whether a road vehicle has been built.
* @return \c true if at least one road vehicle has been built, \c false if not
*/
bool RoadVehiclesAreBuilt()
{
return !RoadVehicle::Iterate().empty();
}
/**
* Verify whether a road vehicle has been built and is not in a depot.
* @return \c true if at least one road vehicle has been built and is not in a depot, \c false if not
*/
bool RoadVehiclesExistOutsideDepots()
{
for (const RoadVehicle *rv : RoadVehicle::Iterate()) {
if (rv->IsFrontEngine() && !rv->IsChainInDepot()) return true;
}
return false;
}
static DisallowedRoadDirections GetOneWayRoadTileDisallowedRoadDirections(TileIndex tile)
{
if (IsNormalRoadTile(tile)) return GetDisallowedRoadDirections(tile);