TBTR: Allow flipping direction of vehicles in template editor
This commit is contained in:
@@ -378,7 +378,10 @@ public:
|
|||||||
GetDepotVehiclePtData gdvp = { nullptr, nullptr };
|
GetDepotVehiclePtData gdvp = { nullptr, nullptr };
|
||||||
|
|
||||||
if (this->GetVehicleFromDepotWndPt(pt.x - nwi->pos_x, pt.y - nwi->pos_y, &v, &gdvp) == MODE_DRAG_VEHICLE && sel != INVALID_VEHICLE) {
|
if (this->GetVehicleFromDepotWndPt(pt.x - nwi->pos_x, pt.y - nwi->pos_y, &v, &gdvp) == MODE_DRAG_VEHICLE && sel != INVALID_VEHICLE) {
|
||||||
if (gdvp.wagon == nullptr || gdvp.wagon->index != sel) {
|
if (gdvp.wagon != nullptr && gdvp.wagon->index == sel && _ctrl_pressed) {
|
||||||
|
DoCommandP(Vehicle::Get(sel)->tile, Vehicle::Get(sel)->index, true,
|
||||||
|
CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE));
|
||||||
|
} else if (gdvp.wagon == nullptr || gdvp.wagon->index != sel) {
|
||||||
this->vehicle_over = INVALID_VEHICLE;
|
this->vehicle_over = INVALID_VEHICLE;
|
||||||
TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
|
TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
|
||||||
}
|
}
|
||||||
|
@@ -2409,7 +2409,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32
|
|||||||
|
|
||||||
Train *front = v->First();
|
Train *front = v->First();
|
||||||
/* make sure the vehicle is stopped in the depot */
|
/* make sure the vehicle is stopped in the depot */
|
||||||
if (!front->IsStoppedInDepot()) {
|
if (!front->IsStoppedInDepot() && !front->IsVirtual()) {
|
||||||
return_cmd_error(STR_ERROR_TRAINS_CAN_ONLY_BE_ALTERED_INSIDE_A_DEPOT);
|
return_cmd_error(STR_ERROR_TRAINS_CAN_ONLY_BE_ALTERED_INSIDE_A_DEPOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user