Feature: Order flag to unbunch vehicles at depot (#11945)

This commit is contained in:
Tyler Trahan
2024-02-03 08:04:24 -05:00
committed by GitHub
parent a0c480c4e4
commit f6dd5053a3
20 changed files with 293 additions and 28 deletions
+12 -2
View File
@@ -387,7 +387,12 @@ CommandCost CmdTurnRoadVeh(DoCommandFlag flags, VehicleID veh_id)
if (IsTileType(v->tile, MP_TUNNELBRIDGE) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
if (flags & DC_EXEC) v->reverse_ctr = 180;
if (flags & DC_EXEC) {
v->reverse_ctr = 180;
/* Unbunching data is no longer valid. */
v->ResetDepotUnbunching();
}
return CommandCost();
}
@@ -1030,6 +1035,7 @@ bool RoadVehLeaveDepot(RoadVehicle *v, bool first)
if (RoadVehFindCloseTo(v, x, y, v->direction, false) != nullptr) return true;
VehicleServiceInDepot(v);
v->LeaveUnbunchingDepot();
StartRoadVehSound(v);
@@ -1587,7 +1593,11 @@ static bool RoadVehController(RoadVehicle *v)
if (v->current_order.IsType(OT_LOADING)) return true;
if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return true;
if (v->IsInDepot()) {
/* Check if we should wait here for unbunching. */
if (v->IsWaitingForUnbunching()) return true;
if (RoadVehLeaveDepot(v, true)) return true;
}
v->ShowVisualEffect();