* Allow or forbid a specific company to use an engine * @param flags operation to perform * @param engine_id engine id * @param company_id Company to allow/forbid the use of an engine. * @param allow false to forbid, true to allow. * @return the cost of this operation or an error */
| 1055 | * @return the cost of this operation or an error |
| 1056 | */ |
| 1057 | CommandCost CmdEngineCtrl(DoCommandFlags flags, EngineID engine_id, CompanyID company_id, bool allow) |
| 1058 | { |
| 1059 | if (_current_company != OWNER_DEITY) return CMD_ERROR; |
| 1060 | |
| 1061 | if (!Engine::IsValidID(engine_id) || !Company::IsValidID(company_id)) return CMD_ERROR; |
| 1062 | |
| 1063 | if (flags.Test(DoCommandFlag::Execute)) { |
| 1064 | if (allow) { |
| 1065 | EnableEngineForCompany(engine_id, company_id); |
| 1066 | } else { |
| 1067 | DisableEngineForCompany(engine_id, company_id); |
| 1068 | } |
| 1069 | } |
| 1070 | |
| 1071 | return CommandCost(); |
| 1072 | } |
| 1073 | |
| 1074 | /** |
| 1075 | * An engine has become available for general use. |
nothing calls this directly
no test coverage detected