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

@@ -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);