Add: company 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 534f2419ad
commit 8d443d1379
10 changed files with 87 additions and 0 deletions

View File

@@ -238,6 +238,7 @@ template<bool Tfrom, bool Tvia>
/* static */ bool ScriptStation::OpenCloseAirport(StationID station_id)
{
EnforceCompanyModeValid(false);
EnforcePrecondition(false, IsValidStation(station_id));
EnforcePrecondition(false, HasStationType(station_id, STATION_AIRPORT));