diff --git a/src/script/api/script_industry.cpp b/src/script/api/script_industry.cpp index 93047868e8..1f114c1c45 100644 --- a/src/script/api/script_industry.cpp +++ b/src/script/api/script_industry.cpp @@ -53,6 +53,7 @@ { CCountedPtr counter(text); + EnforceDeityMode(false); EnforcePrecondition(false, IsValidIndustry(industry_id)); return ScriptObject::Command::Do(industry_id, text != nullptr ? text->GetEncodedText() : std::string{}); @@ -268,6 +269,7 @@ /* static */ bool ScriptIndustry::SetExclusiveSupplier(IndustryID industry_id, ScriptCompany::CompanyID company_id) { + EnforceDeityMode(false); EnforcePrecondition(false, IsValidIndustry(industry_id)); auto company = ScriptCompany::ResolveCompanyID(company_id); @@ -287,6 +289,7 @@ /* static */ bool ScriptIndustry::SetExclusiveConsumer(IndustryID industry_id, ScriptCompany::CompanyID company_id) { + EnforceDeityMode(false); EnforcePrecondition(false, IsValidIndustry(industry_id)); auto company = ScriptCompany::ResolveCompanyID(company_id); diff --git a/src/script/api/script_industry.hpp b/src/script/api/script_industry.hpp index 46acb1d958..d7fca868d0 100644 --- a/src/script/api/script_industry.hpp +++ b/src/script/api/script_industry.hpp @@ -85,6 +85,7 @@ public: * Set the custom text of an industry, shown in the GUI. * @param industry_id The industry to set the custom text of. * @param text The text to set it to (can be either a raw string, or a ScriptText object). If null, or an empty string, is passed, the text will be removed. + * @pre ScriptCompanyMode::IsDeity(). * @pre IsValidIndustry(industry_id). * @return True if the action succeeded. * @api -ai @@ -286,6 +287,7 @@ public: * @param industry_id The index of the industry. * @param company_id The company to set (ScriptCompany::COMPANY_INVALID to reset). * @pre IsValidIndustry(industry_id). + * @pre ScriptCompanyMode::IsDeity(). * @return True if the action succeeded. * @api -ai */ @@ -306,6 +308,7 @@ public: * @param industry_id The index of the industry. * @param company_id The company to set (ScriptCompany::COMPANY_INVALID to reset). * @pre IsValidIndustry(industry_id). + * @pre ScriptCompanyMode::IsDeity(). * @return True if the action succeeded. * @api -ai */ diff --git a/src/script/api/script_news.cpp b/src/script/api/script_news.cpp index 290810eb69..6d668fea05 100644 --- a/src/script/api/script_news.cpp +++ b/src/script/api/script_news.cpp @@ -24,6 +24,7 @@ { CCountedPtr counter(text); + EnforceDeityMode(false); EnforcePrecondition(false, text != nullptr); const std::string &encoded = text->GetEncodedText(); EnforcePreconditionEncodedText(false, encoded); diff --git a/src/script/api/script_news.hpp b/src/script/api/script_news.hpp index 4518a56047..808964f7ba 100644 --- a/src/script/api/script_news.hpp +++ b/src/script/api/script_news.hpp @@ -62,6 +62,7 @@ public: * @pre text != null. * @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID. * @pre The \a reference condition must be fulfilled. + * @pre ScriptCompanyMode::IsDeity(). */ static bool Create(NewsType type, Text *text, ScriptCompany::CompanyID company, NewsReferenceType ref_type, SQInteger reference); }; diff --git a/src/script/api/script_subsidy.cpp b/src/script/api/script_subsidy.cpp index 0372f315cb..afc6eef14b 100644 --- a/src/script/api/script_subsidy.cpp +++ b/src/script/api/script_subsidy.cpp @@ -33,6 +33,7 @@ /* static */ bool ScriptSubsidy::Create(CargoID cargo_type, SubsidyParticipantType from_type, SQInteger from_id, SubsidyParticipantType to_type, SQInteger to_id) { + EnforceDeityMode(false); EnforcePrecondition(false, ScriptCargo::IsValidCargo(cargo_type)); EnforcePrecondition(false, from_type == SPT_INDUSTRY || from_type == SPT_TOWN); EnforcePrecondition(false, to_type == SPT_INDUSTRY || to_type == SPT_TOWN); diff --git a/src/script/api/script_subsidy.hpp b/src/script/api/script_subsidy.hpp index b59d8bb591..dd71ab036b 100644 --- a/src/script/api/script_subsidy.hpp +++ b/src/script/api/script_subsidy.hpp @@ -55,6 +55,7 @@ public: * @param to_type The type of the subsidy on the 'to' side. * @param to_id The ID of the 'to' side. * @return True if the action succeeded. + * @pre ScriptCompanyMode::IsDeity(). * @pre ScriptCargo::IsValidCargo(cargo_type) * @pre from_type == SPT_INDUSTRY || from_type == SPT_TOWN. * @pre to_type == SPT_INDUSTRY || to_type == SPT_TOWN. diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp index 6bdd2283ff..c39b9e1185 100644 --- a/src/script/api/script_town.cpp +++ b/src/script/api/script_town.cpp @@ -44,6 +44,7 @@ { CCountedPtr counter(name); + EnforceDeityMode(false); EnforcePrecondition(false, IsValidTown(town_id)); std::string text; if (name != nullptr) { @@ -58,6 +59,7 @@ { CCountedPtr counter(text); + EnforceDeityMode(false); EnforcePrecondition(false, IsValidTown(town_id)); return ScriptObject::Command::Do(town_id, text != nullptr ? text->GetEncodedText() : std::string{}); @@ -125,6 +127,7 @@ /* static */ bool ScriptTown::SetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id, SQInteger goal) { + EnforceDeityMode(false); EnforcePrecondition(false, IsValidTown(town_id)); EnforcePrecondition(false, ScriptCargo::IsValidTownEffect(towneffect_id)); @@ -155,6 +158,7 @@ /* static */ bool ScriptTown::SetGrowthRate(TownID town_id, SQInteger days_between_town_growth) { + EnforceDeityMode(false); EnforcePrecondition(false, IsValidTown(town_id)); uint16 growth_rate; switch (days_between_town_growth) { diff --git a/src/script/api/script_town.hpp b/src/script/api/script_town.hpp index a4b5117b35..bd2167f0f7 100644 --- a/src/script/api/script_town.hpp +++ b/src/script/api/script_town.hpp @@ -149,6 +149,7 @@ public: * @param town_id The town to rename * @param name The new name of the town. If null, or an empty string, is passed, the town name will be reset to the default name. * @pre IsValidTown(town_id). + * @pre ScriptCompanyMode::IsDeity(). * @return True if the action succeeded. * @api -ai */ @@ -159,6 +160,7 @@ public: * @param town_id The town to set the custom text of. * @param text The text to set it to (can be either a raw string, or a ScriptText object). If null, or an empty string, is passed, the text will be removed. * @pre IsValidTown(town_id). + * @pre ScriptCompanyMode::IsDeity(). * @return True if the action succeeded. * @api -ai */ @@ -236,6 +238,7 @@ public: * The value will be clamped to 0 .. MAX(uint32). * @pre IsValidTown(town_id). * @pre ScriptCargo::IsValidTownEffect(towneffect_id). + * @pre ScriptCompanyMode::IsDeity(). * @return True if the action succeeded. * @api -ai */ @@ -392,6 +395,7 @@ public: * The value will be clamped to 0 .. MAX(uint32). * @pre IsValidTown(town_id). * @pre houses > 0. + * @pre ScriptCompanyMode::IsDeity(). * @return True if the action succeeded. * @api -ai */