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

View File

@@ -2112,6 +2112,9 @@ CommandCost CmdReverseTrainDirection(DoCommandFlag flags, VehicleID veh_id, bool
HideFillingPercent(&v->fill_percent_te_id);
ReverseTrainDirection(v);
}
/* Unbunching data is no longer valid. */
v->ResetDepotUnbunching();
}
}
return CommandCost();
@@ -2142,6 +2145,9 @@ CommandCost CmdForceTrainProceed(DoCommandFlag flags, VehicleID veh_id)
* next signal we encounter. */
t->force_proceed = t->force_proceed == TFP_SIGNAL ? TFP_NONE : HasBit(t->flags, VRF_TRAIN_STUCK) || t->IsChainInDepot() ? TFP_STUCK : TFP_SIGNAL;
SetWindowDirty(WC_VEHICLE_VIEW, t->index);
/* Unbunching data is no longer valid. */
t->ResetDepotUnbunching();
}
return CommandCost();
@@ -2275,6 +2281,9 @@ static bool CheckTrainStayInDepot(Train *v)
return true;
}
/* Check if we should wait here for unbunching. */
if (v->IsWaitingForUnbunching()) return true;
SigSegState seg_state;
if (v->force_proceed == TFP_NONE) {
@@ -2315,8 +2324,9 @@ static bool CheckTrainStayInDepot(Train *v)
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile);
VehicleServiceInDepot(v);
SetWindowClassesDirty(WC_TRAINS_LIST);
v->LeaveUnbunchingDepot();
v->PlayLeaveStationSound();
SetWindowClassesDirty(WC_TRAINS_LIST);
v->track = TRACK_BIT_X;
if (v->direction & 2) v->track = TRACK_BIT_Y;