diff --git a/aircraft_cmd.c b/aircraft_cmd.c index d6661266ab..1ed9962f14 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -402,7 +402,6 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) GetPlayer(_current_player)->num_engines[p1]++; InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); if (IsLocalPlayer()) @@ -1435,7 +1434,6 @@ static void AircraftLeaveHangar(Vehicle *v) VehicleServiceInDepot(v); SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClasses(WC_AIRCRAFT_LIST); } diff --git a/build_vehicle_gui.c b/build_vehicle_gui.c index b1c82c95f4..dc4e0e7ddc 100644 --- a/build_vehicle_gui.c +++ b/build_vehicle_gui.c @@ -428,7 +428,6 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_INVALIDATE_DATA: GenerateBuildList(w); - SetWindowDirty(w); break; case WE_DESTROY: diff --git a/rail_cmd.c b/rail_cmd.c index cb5ff4213a..19af91a9b3 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -2010,11 +2010,10 @@ static uint32 VehicleEnter_Track(Vehicle *v, TileIndex tile, int x, int y) v->u.rail.track = 0x80, v->vehstatus |= VS_HIDDEN; /* hide it */ v->direction = ReverseDir(v->direction); - InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - if (v->next == NULL) - VehicleEnterDepot(v); + if (v->next == NULL) VehicleEnterDepot(v); v->tile = tile; - InvalidateWindow(WC_VEHICLE_DEPOT, tile); + + InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); return 4; } } else if (fract_coord_leave == fract_coord) { diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 04959beee5..0777dec283 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -195,7 +195,6 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) GetPlayer(_current_player)->num_engines[p1]++; InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); if (IsLocalPlayer()) @@ -1307,7 +1306,6 @@ static void RoadVehController(Vehicle *v) SetRoadVehPosition(v,x,y); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); return; } diff --git a/roadveh_gui.c b/roadveh_gui.c index e2c3ccf9d6..1dfb48789b 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -455,10 +455,6 @@ void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2) static void NewRoadVehWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_INVALIDATE_DATA: - SetWindowDirty(w); - break; - case WE_PAINT: DrawNewRoadVehWindow(w); break; diff --git a/ship_cmd.c b/ship_cmd.c index 6910080734..c2ce21e992 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -884,7 +884,6 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) GetPlayer(_current_player)->num_engines[p1]++; InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); if (IsLocalPlayer()) diff --git a/ship_gui.c b/ship_gui.c index 90663533ab..c0719d803e 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -242,10 +242,6 @@ void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2) static void NewShipWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_INVALIDATE_DATA: - SetWindowDirty(w); - break; - case WE_PAINT: { EngineID selected_id; EngineID eid; diff --git a/train_cmd.c b/train_cmd.c index 33303a1522..283a8ccc29 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -851,7 +851,6 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) GetPlayer(_current_player)->num_engines[p1]++; InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); if (IsLocalPlayer()) { @@ -1682,7 +1681,6 @@ static void ReverseTrainDirection(Vehicle *v) if (IsTileDepotType(v->tile, TRANSPORT_RAIL)) { InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); } /* Check if we were approaching a rail/road-crossing */ @@ -1716,7 +1714,6 @@ static void ReverseTrainDirection(Vehicle *v) if (IsTileDepotType(v->tile, TRANSPORT_RAIL)) { InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); } CLRBIT(v->u.rail.flags, VRF_REVERSING); @@ -2213,7 +2210,6 @@ static bool CheckTrainStayInDepot(Vehicle *v) UpdateSignalsOnSegment(v->tile, DirToDiagDir(v->direction)); UpdateTrainAcceleration(v); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); return false; } diff --git a/train_gui.c b/train_gui.c index 94fb07cb4c..d3b30df7bb 100644 --- a/train_gui.c +++ b/train_gui.c @@ -473,7 +473,6 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e) case WE_INVALIDATE_DATA: GenerateBuildList(w); - SetWindowDirty(w); break; case WE_DESTROY: diff --git a/window.c b/window.c index bfe2bba1bf..58de0affa9 100644 --- a/window.c +++ b/window.c @@ -1767,6 +1767,7 @@ void InvalidateWindowClasses(WindowClass cls) void InvalidateThisWindowData(Window *w) { CallWindowEventNP(w, WE_INVALIDATE_DATA); + SetWindowDirty(w); } void InvalidateWindowData(WindowClass cls, WindowNumber number)