Add: precondition checks to functions that work with both valid company and deity
These are functions that either use ScriptObject::Command or 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. At this moment these checks will not do anything useful, as either IsValid or IsDeity from ScriptCompanyMode returns true, but that will change later.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
/* static */ bool ScriptStation::IsValidStation(StationID station_id)
|
||||
{
|
||||
EnforceDeityOrCompanyModeValid(false);
|
||||
const Station *st = ::Station::GetIfValid(station_id);
|
||||
return st != nullptr && (st->owner == ScriptObject::GetCompany() || ScriptCompanyMode::IsDeity() || st->owner == OWNER_NONE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user