Add: [Script] GSIndustry.GetConstructionDate() method (#11145)

pull/603/merge
Andy 11 months ago committed by GitHub
parent 0be27778af
commit ce9305a5ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,6 +18,7 @@
* This version is not yet released. The following changes are not set in stone yet.
*
* API additions:
* \li GSIndustry::GetConstructionDate
* \li GSAsyncMode
* \li GSCompanyMode::IsValid
* \li GSCompanyMode::IsDeity

@ -49,6 +49,13 @@
return GetString(STR_INDUSTRY_NAME);
}
/* static */ ScriptDate::Date ScriptIndustry::GetConstructionDate(IndustryID industry_id)
{
Industry *i = Industry::GetIfValid(industry_id);
if (i == nullptr) return ScriptDate::DATE_INVALID;
return (ScriptDate::Date)i->construction_date;
}
/* static */ bool ScriptIndustry::SetText(IndustryID industry_id, Text *text)
{
CCountedPtr<Text> counter(text);

@ -81,6 +81,15 @@ public:
*/
static std::optional<std::string> GetName(IndustryID industry_id);
/**
* Get the construction date of an industry.
* @param industry_id The index of the industry.
* @pre IsValidIndustry(industry_id).
* @return Date the industry was constructed.
* @api -ai
*/
static ScriptDate::Date GetConstructionDate(IndustryID industry_id);
/**
* Set the custom text of an industry, shown in the GUI.
* @param industry_id The industry to set the custom text of.

Loading…
Cancel
Save