static */
| 25 | #include "../../safeguards.h" |
| 26 | |
| 27 | /* static */ bool ScriptEngine::IsValidEngine(EngineID engine_id) |
| 28 | { |
| 29 | EnforceDeityOrCompanyModeValid(false); |
| 30 | const Engine *e = ::Engine::GetIfValid(engine_id); |
| 31 | if (e == nullptr || !e->IsEnabled()) return false; |
| 32 | |
| 33 | /* AIs have only access to engines they can purchase or still have in use. |
| 34 | * Deity has access to all engined that will be or were available ever. */ |
| 35 | ::CompanyID company = ScriptObject::GetCompany(); |
| 36 | return ScriptCompanyMode::IsDeity() || ::IsEngineBuildable(engine_id, e->type, company) || ::Company::Get(company)->group_all[e->type].GetNumEngines(engine_id) > 0; |
| 37 | } |
| 38 | |
| 39 | /* static */ bool ScriptEngine::IsBuildable(EngineID engine_id) |
| 40 | { |
nothing calls this directly
no test coverage detected