Codechange: Use SQInteger for generic numbers in script_industry

This commit is contained in:
glx22 2023-03-04 15:50:14 +01:00 committed by Loïc Guilloux
parent 8eb35633ec
commit 6671994655
2 changed files with 25 additions and 25 deletions

View File

@ -25,9 +25,9 @@
#include "../../safeguards.h"
/* static */ int32 ScriptIndustry::GetIndustryCount()
/* static */ SQInteger ScriptIndustry::GetIndustryCount()
{
return (int32)::Industry::GetNumItems();
return ::Industry::GetNumItems();
}
/* static */ bool ScriptIndustry::IsValidIndustry(IndustryID industry_id)
@ -75,7 +75,7 @@
return CAS_NOT_ACCEPTED;
}
/* static */ int32 ScriptIndustry::GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id)
/* static */ SQInteger ScriptIndustry::GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
@ -91,7 +91,7 @@
return -1;
}
/* static */ int32 ScriptIndustry::GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id)
/* static */ SQInteger ScriptIndustry::GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
@ -105,7 +105,7 @@
return -1;
}
/* static */ int32 ScriptIndustry::GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id)
/* static */ SQInteger ScriptIndustry::GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
@ -119,7 +119,7 @@
return -1;
}
/* static */ int32 ScriptIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
/* static */ SQInteger ScriptIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
@ -140,22 +140,22 @@
return ::Industry::Get(industry_id)->location.tile;
}
/* static */ int32 ScriptIndustry::GetAmountOfStationsAround(IndustryID industry_id)
/* static */ SQInteger ScriptIndustry::GetAmountOfStationsAround(IndustryID industry_id)
{
if (!IsValidIndustry(industry_id)) return -1;
Industry *ind = ::Industry::Get(industry_id);
return (int32)ind->stations_near.size();
return ind->stations_near.size();
}
/* static */ int32 ScriptIndustry::GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile)
/* static */ SQInteger ScriptIndustry::GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile)
{
if (!IsValidIndustry(industry_id)) return -1;
return ScriptMap::DistanceManhattan(tile, GetLocation(industry_id));
}
/* static */ int32 ScriptIndustry::GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile)
/* static */ SQInteger ScriptIndustry::GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile)
{
if (!IsValidIndustry(industry_id)) return -1;
@ -220,14 +220,14 @@
return ::Industry::Get(industry_id)->type;
}
int32 ScriptIndustry::GetLastProductionYear(IndustryID industry_id)
/* static */ SQInteger ScriptIndustry::GetLastProductionYear(IndustryID industry_id)
{
Industry *i = Industry::GetIfValid(industry_id);
if (i == nullptr) return 0;
return i->last_prod_year;
}
ScriptDate::Date ScriptIndustry::GetCargoLastAcceptedDate(IndustryID industry_id, CargoID cargo_type)
/* static */ ScriptDate::Date ScriptIndustry::GetCargoLastAcceptedDate(IndustryID industry_id, CargoID cargo_type)
{
Industry *i = Industry::GetIfValid(industry_id);
if (i == nullptr) return ScriptDate::DATE_INVALID;
@ -241,14 +241,14 @@ ScriptDate::Date ScriptIndustry::GetCargoLastAcceptedDate(IndustryID industry_id
}
}
uint32 ScriptIndustry::GetControlFlags(IndustryID industry_id)
/* static */ SQInteger ScriptIndustry::GetControlFlags(IndustryID industry_id)
{
Industry *i = Industry::GetIfValid(industry_id);
if (i == nullptr) return 0;
return i->ctlflags;
}
bool ScriptIndustry::SetControlFlags(IndustryID industry_id, uint32 control_flags)
/* static */ bool ScriptIndustry::SetControlFlags(IndustryID industry_id, SQInteger control_flags)
{
if (ScriptObject::GetCompany() != OWNER_DEITY) return false;
if (!IsValidIndustry(industry_id)) return false;

View File

@ -54,7 +54,7 @@ public:
* @return The number of industries.
* @note The maximum valid IndustryID can be higher than the value returned.
*/
static int32 GetIndustryCount();
static SQInteger GetIndustryCount();
/**
* Checks whether the given industry index is valid.
@ -109,7 +109,7 @@ public:
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The amount of cargo that is waiting for processing.
*/
static int32 GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id);
static SQInteger GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id);
/**
* Get the total last month's production of the given cargo at an industry.
@ -119,7 +119,7 @@ public:
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The last month's production of the given cargo for this industry.
*/
static int32 GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id);
static SQInteger GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id);
/**
* Get the total amount of cargo transported from an industry last month.
@ -129,7 +129,7 @@ public:
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The amount of given cargo transported from this industry last month.
*/
static int32 GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id);
static SQInteger GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id);
/**
* Get the percentage of cargo transported from an industry last month.
@ -139,7 +139,7 @@ public:
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The percentage of given cargo transported from this industry last month.
*/
static int32 GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id);
static SQInteger GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id);
/**
* Gets the location of the industry.
@ -157,7 +157,7 @@ public:
* @pre IsValidIndustry(industry_id).
* @return The number of stations around an industry.
*/
static int32 GetAmountOfStationsAround(IndustryID industry_id);
static SQInteger GetAmountOfStationsAround(IndustryID industry_id);
/**
* Get the manhattan distance from the tile to the ScriptIndustry::GetLocation()
@ -168,7 +168,7 @@ public:
* @pre ScriptMap::IsValidTile(tile).
* @return The distance between industry and tile.
*/
static int32 GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile);
static SQInteger GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile);
/**
* Get the square distance from the tile to the ScriptIndustry::GetLocation()
@ -179,7 +179,7 @@ public:
* @pre ScriptMap::IsValidTile(tile).
* @return The distance between industry and tile.
*/
static int32 GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile);
static SQInteger GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile);
/**
* Is this industry built on water.
@ -238,7 +238,7 @@ public:
* @return Year the industry last had production, 0 if error.
* @api -ai
*/
static int32 GetLastProductionYear(IndustryID industry_id);
static SQInteger GetLastProductionYear(IndustryID industry_id);
/**
* Get the last date this industry accepted any cargo delivery.
@ -258,7 +258,7 @@ public:
* @return Bit flags of the IndustryControlFlags enumeration.
* @api -ai
*/
static uint32 GetControlFlags(IndustryID industry_id);
static SQInteger GetControlFlags(IndustryID industry_id);
/**
* Change the control flags for an industry.
@ -269,7 +269,7 @@ public:
* @return True if the action succeeded.
* @api -ai
*/
static bool SetControlFlags(IndustryID industry_id, uint32 control_flags);
static bool SetControlFlags(IndustryID industry_id, SQInteger control_flags);
/**
* Find out which company currently has the exclusive rights to deliver cargo to the industry.