mirror of https://github.com/OpenTTD/OpenTTD.git
Fix: [Script] Inconsistent precondition failure return values
This commit is contained in:
parent
e06a666fa2
commit
b6f3552e4b
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue