* Set the visibility of an engine. * @param flags Operation to perform. * @param engine_id Engine id.. * @param hide Set for hidden, unset for visible. * @return The cost of this operation or an error. */
| 1016 | * @return The cost of this operation or an error. |
| 1017 | */ |
| 1018 | CommandCost CmdSetVehicleVisibility(DoCommandFlags flags, EngineID engine_id, bool hide) |
| 1019 | { |
| 1020 | Engine *e = Engine::GetIfValid(engine_id); |
| 1021 | if (e == nullptr || _current_company >= MAX_COMPANIES) return CMD_ERROR; |
| 1022 | if (!IsEngineBuildable(e->index, e->type, _current_company)) return CMD_ERROR; |
| 1023 | |
| 1024 | if (flags.Test(DoCommandFlag::Execute)) { |
| 1025 | e->company_hidden.Set(_current_company, hide); |
| 1026 | AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type); |
| 1027 | } |
| 1028 | |
| 1029 | return CommandCost(); |
| 1030 | } |
| 1031 | |
| 1032 | /** |
| 1033 | * Accept an engine prototype. XXX - it is possible that the top-company |
nothing calls this directly
no test coverage detected