Codechange: Use SQInteger for generic numbers in script_industry
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user