mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-19 19:49:30 +01:00
Add: [Script] GSIndustry.GetConstructionDate() method (#11145)
This commit is contained in:
parent
0be27778af
commit
ce9305a5ee
@ -18,6 +18,7 @@
|
|||||||
* This version is not yet released. The following changes are not set in stone yet.
|
* This version is not yet released. The following changes are not set in stone yet.
|
||||||
*
|
*
|
||||||
* API additions:
|
* API additions:
|
||||||
|
* \li GSIndustry::GetConstructionDate
|
||||||
* \li GSAsyncMode
|
* \li GSAsyncMode
|
||||||
* \li GSCompanyMode::IsValid
|
* \li GSCompanyMode::IsValid
|
||||||
* \li GSCompanyMode::IsDeity
|
* \li GSCompanyMode::IsDeity
|
||||||
|
@ -49,6 +49,13 @@
|
|||||||
return GetString(STR_INDUSTRY_NAME);
|
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)
|
/* static */ bool ScriptIndustry::SetText(IndustryID industry_id, Text *text)
|
||||||
{
|
{
|
||||||
CCountedPtr<Text> counter(text);
|
CCountedPtr<Text> counter(text);
|
||||||
|
@ -81,6 +81,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
static std::optional<std::string> GetName(IndustryID industry_id);
|
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.
|
* Set the custom text of an industry, shown in the GUI.
|
||||||
* @param industry_id The industry to set the custom text of.
|
* @param industry_id The industry to set the custom text of.
|
||||||
|
Loading…
Reference in New Issue
Block a user