Fix: [Script] Inconsistent precondition failure return values

This commit is contained in:
glx22 2023-02-10 18:11:57 +01:00 committed by Loïc Guilloux
parent e06a666fa2
commit b6f3552e4b
2 changed files with 4 additions and 4 deletions

View File

@ -158,7 +158,7 @@
/* static */ uint16 ScriptAirport::GetMaintenanceCostFactor(AirportType type)
{
if (!IsAirportInformationAvailable(type)) return INVALID_TOWN;
if (!IsAirportInformationAvailable(type)) return 0;
return AirportSpec::Get(type)->maintenance_cost;
}

View File

@ -452,8 +452,8 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD
/* static */ int32 ScriptRoad::GetNeighbourRoadCount(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
if (!::IsValidTile(tile)) return -1;
if (!IsRoadTypeAvailable(GetCurrentRoadType())) return -1;
::RoadType rt = (::RoadType)GetCurrentRoadType();
int32 neighbour = 0;
@ -627,7 +627,7 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD
/* static */ int32 ScriptRoad::GetMaxSpeed(RoadType road_type)
{
if (!ScriptRoad::IsRoadTypeAvailable(road_type)) return 0;
if (!ScriptRoad::IsRoadTypeAvailable(road_type)) return -1;
return GetRoadTypeInfo((::RoadType)road_type)->max_speed;
}