Allow changing road vehicle driving side when all road vehicles in depots
This commit is contained in:
@@ -180,14 +180,26 @@ RoadType AllocateRoadType(RoadTypeLabel label, RoadTramType rtt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify whether a road vehicle is available.
|
* Verify whether a road vehicle has been built.
|
||||||
* @return \c true if at least one road vehicle is available, \c false if not
|
* @return \c true if at least one road vehicle has been built, \c false if not
|
||||||
*/
|
*/
|
||||||
bool RoadVehiclesAreBuilt()
|
bool RoadVehiclesAreBuilt()
|
||||||
{
|
{
|
||||||
return !RoadVehicle::Iterate().empty();
|
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)
|
static DisallowedRoadDirections GetOneWayRoadTileDisallowedRoadDirections(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (IsNormalRoadTile(tile)) return GetDisallowedRoadDirections(tile);
|
if (IsNormalRoadTile(tile)) return GetDisallowedRoadDirections(tile);
|
||||||
|
@@ -1483,8 +1483,8 @@ static void MaxNoAIsChange(int32 new_value)
|
|||||||
*/
|
*/
|
||||||
static bool CheckRoadSide(int32 &new_value)
|
static bool CheckRoadSide(int32 &new_value)
|
||||||
{
|
{
|
||||||
extern bool RoadVehiclesAreBuilt();
|
extern bool RoadVehiclesExistOutsideDepots();
|
||||||
return (_game_mode == GM_MENU || !RoadVehiclesAreBuilt());
|
return (_game_mode == GM_MENU || !RoadVehiclesExistOutsideDepots());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RoadSideChanged(int32 new_value)
|
static void RoadSideChanged(int32 new_value)
|
||||||
|
Reference in New Issue
Block a user