* Send a vehicle to the depot. * @param flags for command type * @param veh_id vehicle ID to send to the depot * @param depot_cmd DEPOT_ flags (see vehicle_type.h) * @param vli VehicleListIdentifier. * @return the cost of this operation or an error */
| 1054 | * @return the cost of this operation or an error |
| 1055 | */ |
| 1056 | CommandCost CmdSendVehicleToDepot(DoCommandFlags flags, VehicleID veh_id, DepotCommandFlags depot_cmd, const VehicleListIdentifier &vli) |
| 1057 | { |
| 1058 | if (depot_cmd.Test(DepotCommandFlag::MassSend)) { |
| 1059 | /* Mass goto depot requested */ |
| 1060 | if (!vli.Valid()) return CMD_ERROR; |
| 1061 | return SendAllVehiclesToDepot(flags, depot_cmd.Test(DepotCommandFlag::Service), vli); |
| 1062 | } |
| 1063 | |
| 1064 | Vehicle *v = Vehicle::GetIfValid(veh_id); |
| 1065 | if (v == nullptr) return CMD_ERROR; |
| 1066 | if (!v->IsPrimaryVehicle()) return CMD_ERROR; |
| 1067 | |
| 1068 | return v->SendToDepot(flags, depot_cmd); |
| 1069 | } |
| 1070 | |
| 1071 | /** |
| 1072 | * Give a custom name to your vehicle |
nothing calls this directly
no test coverage detected