Changeset - r26960:01cf326aa523
[Not reviewed]
master
0 2 0
glx22 - 16 months ago 2023-02-10 17:11:57
glx@openttd.org
Fix: [Script] Inconsistent precondition failure return values
2 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_airport.cpp
Show inline comments
 
@@ -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;
 
}
src/script/api/script_road.cpp
Show inline comments
 
@@ -452,8 +452,8 @@ static bool NeighbourHasReachableRoad(::
 

	
 
/* 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(::
 

	
 
/* 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;
 
}
0 comments (0 inline, 0 general)