summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-12-01 00:09:13 +0000
committerDarkvater <darkvater@openttd.org>2006-12-01 00:09:13 +0000
commit04f99447469d335af52702aad35cc2d3f705c06d (patch)
tree34e228c15bbd169f5c13601b61aa43ae9e3b95ba
parent9b4d3ff4b88eb6d655bf31afc28a6afa849f07f7 (diff)
downloadopenttd-04f99447469d335af52702aad35cc2d3f705c06d.tar.xz
(svn r7313) -Codechange: Calling invalidate data on a window will surely warrant a redraw, so call
that after the WE_INVALIDATE_DATA event and remove (some of) the superflouous calls.
-rw-r--r--aircraft_cmd.c2
-rw-r--r--build_vehicle_gui.c1
-rw-r--r--rail_cmd.c7
-rw-r--r--roadveh_cmd.c2
-rw-r--r--roadveh_gui.c4
-rw-r--r--ship_cmd.c1
-rw-r--r--ship_gui.c4
-rw-r--r--train_cmd.c4
-rw-r--r--train_gui.c1
-rw-r--r--window.c1
10 files changed, 4 insertions, 23 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index d6661266a..1ed9962f1 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 b1c82c95f..dc4e0e7dd 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 cb5ff4213..19af91a9b 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 04959beee..0777dec28 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 e2c3ccf9d..1dfb48789 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 691008073..c2ce21e99 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 90663533a..c0719d803 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 33303a152..283a8ccc2 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 94fb07cb4..d3b30df7b 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 bfe2bba1b..58de0affa 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)