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

Function TrainDepotMoveVehicle

src/depot_gui.cpp:133–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Vehicle *head)
134{
135 const Vehicle *v = Vehicle::Get(sel);
136
137 if (v == wagon) return;
138
139 if (wagon == nullptr) {
140 if (head != nullptr) wagon = head->Last();
141 } else {
142 wagon = wagon->Previous();
143 if (wagon == nullptr) return;
144 }
145
146 if (wagon == v) return;
147
148 Command<CMD_MOVE_RAIL_VEHICLE>::Post(STR_ERROR_CAN_T_MOVE_VEHICLE, v->tile, v->index, wagon == nullptr ? VehicleID::Invalid() : wagon->index, _ctrl_pressed);
149}
150
151static VehicleCellSize _base_block_sizes_depot[VEH_COMPANY_END]; ///< Cell size for vehicle images in the depot view.
152static VehicleCellSize _base_block_sizes_purchase[VEH_COMPANY_END]; ///< Cell size for vehicle images in the purchase list.

Callers 2

DepotClickMethod · 0.85
OnDragDropMethod · 0.85

Calls 3

InvalidFunction · 0.85
LastMethod · 0.45
PreviousMethod · 0.45

Tested by

no test coverage detected