MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CmdSendVehicleToDepot

Function CmdSendVehicleToDepot

src/vehicle_cmd.cpp:1056–1069  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

1054 * @return the cost of this operation or an error
1055 */
1056CommandCost 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

Callers

nothing calls this directly

Calls 5

SendAllVehiclesToDepotFunction · 0.85
TestMethod · 0.80
ValidMethod · 0.80
SendToDepotMethod · 0.80
IsPrimaryVehicleMethod · 0.45

Tested by

no test coverage detected