Add: [Script] Custom news message text for industry SetProductionLevel.
This commit is contained in:
@@ -302,11 +302,13 @@
|
||||
return i->prod_level;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptIndustry::SetProductionLevel(IndustryID industry_id, SQInteger prod_level, bool show_news)
|
||||
/* static */ bool ScriptIndustry::SetProductionLevel(IndustryID industry_id, SQInteger prod_level, bool show_news, Text *custom_news)
|
||||
{
|
||||
CCountedPtr<Text> counter(custom_news);
|
||||
|
||||
EnforceDeityMode(false);
|
||||
EnforcePrecondition(false, IsValidIndustry(industry_id));
|
||||
EnforcePrecondition(false, prod_level >= PRODLEVEL_MINIMUM && prod_level <= PRODLEVEL_MAXIMUM);
|
||||
|
||||
return ScriptObject::Command<CMD_INDUSTRY_SET_PRODUCTION>::Do(industry_id, prod_level, show_news);
|
||||
return ScriptObject::Command<CMD_INDUSTRY_SET_PRODUCTION>::Do(industry_id, prod_level, show_news, custom_news != nullptr ? custom_news->GetEncodedText() : std::string{});
|
||||
}
|
||||
|
@@ -341,13 +341,14 @@ public:
|
||||
* @param industry_id The index of the industry.
|
||||
* @param prod_level The production level to set.
|
||||
* @param show_news If set to true and the production changed, generate a production change news message. If set to false, no news message is shown.
|
||||
* @param custom_news Custom news message text to override the default news text with. Pass null to use the default text. Only used if \c show_news is set to true.
|
||||
* @pre IsValidIndustry(industry_id).
|
||||
* @pre ScriptCompanyMode::IsDeity().
|
||||
* @pre prod_level >= 4 && prod_level <= 128.
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool SetProductionLevel(IndustryID industry_id, SQInteger prod_level, bool show_news);
|
||||
static bool SetProductionLevel(IndustryID industry_id, SQInteger prod_level, bool show_news, Text *custom_news);
|
||||
};
|
||||
|
||||
#endif /* SCRIPT_INDUSTRY_HPP */
|
||||
|
Reference in New Issue
Block a user