Codechange: Use proper widget type and update widgets properly (#14870)

For vehicle window.
This commit is contained in:
Cyprian Klimaszewski
2026-01-08 22:31:00 +00:00
committed by GitHub
parent 52d6a579e5
commit d405e4cb09
5 changed files with 25 additions and 20 deletions
+6 -6
View File
@@ -2097,7 +2097,7 @@ CommandCost CmdReverseTrainDirection(DoCommandFlags flags, VehicleID veh_id, boo
front->ConsistChanged(CCF_ARRANGE);
SetWindowDirty(WC_VEHICLE_DEPOT, front->tile);
SetWindowDirty(WC_VEHICLE_DETAILS, front->index);
SetWindowDirty(WC_VEHICLE_VIEW, front->index);
InvalidateWindowData(WC_VEHICLE_VIEW, front->index);
SetWindowClassesDirty(WC_TRAINS_LIST);
}
} else {
@@ -2119,7 +2119,7 @@ CommandCost CmdReverseTrainDirection(DoCommandFlags flags, VehicleID veh_id, boo
/* We cancel any 'skip signal at dangers' here */
v->force_proceed = TFP_NONE;
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && v->cur_speed != 0) {
v->flags.Flip(VehicleRailFlag::Reversing);
@@ -2177,7 +2177,7 @@ CommandCost CmdForceTrainProceed(DoCommandFlags flags, VehicleID veh_id)
if (flags.Test(DoCommandFlag::Execute)) {
t->force_proceed = DetermineNextTrainForceProceeding(t);
SetWindowDirty(WC_VEHICLE_VIEW, t->index);
InvalidateWindowData(WC_VEHICLE_VIEW, t->index);
/* Unbunching data is no longer valid. */
t->ResetDepotUnbunching();
@@ -3049,7 +3049,7 @@ static void TrainEnterStation(Train *v, StationID station)
}
v->force_proceed = TFP_NONE;
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
v->BeginLoading();
@@ -3363,7 +3363,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
/* However, we do not want to be stopped by PBS signals
* entered via the back. */
v->force_proceed = (v->force_proceed == TFP_SIGNAL) ? TFP_STUCK : TFP_NONE;
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
}
}
@@ -4034,7 +4034,7 @@ static bool TrainLocoHandler(Train *v, bool mode)
if (v->cur_speed == 0 && v->vehstatus.Test(VehState::Stopped)) {
/* If we manually stopped, we're not force-proceeding anymore. */
v->force_proceed = TFP_NONE;
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
}
int adv_spd = v->GetAdvanceDistance();