Add: deity mode enforcement checks to functions with command or company access

Command functions are those that call ScriptObject::Command, and functions
with company access are any that call ScriptObject::GetCompany. This is a bit
over-protective, but having the check everywhere makes it easier to validate
that no check is missing automatically instead of by review.
This commit is contained in:
Rubidium
2023-03-02 21:22:37 +01:00
committed by rubidium42
parent 8d443d1379
commit 717f79ff22
8 changed files with 18 additions and 0 deletions

View File

@@ -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
*/