summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-10-05 12:59:28 +0000
committerbjarni <bjarni@openttd.org>2006-10-05 12:59:28 +0000
commitea075f78e04cc5675e890f82e181276ebc6b6f00 (patch)
tree4a3d21fb89f88716ad9e908b35bbfc8df30e3ed2 /rail_cmd.c
parenta9478f810cb260c5f180ece9e38b2d6b4bbc94fe (diff)
downloadopenttd-ea075f78e04cc5675e890f82e181276ebc6b6f00.tar.xz
(svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
This gives the ability to invalidate some window data and recalculate as needed instead of doing it for each WE_PAINT This event is called right away when using InvalidateWindowData(), so it may be a good idea to set a bool or similar in the window or similar and then act on that bool in WE_PAINT instead of doing a lot of stuff in WE_INVALIDATE_DATA as it might be called more than once before WE_PAINT is called InvalidateWindowData() will not automatically repaint the window, so if you want to repaint it as well, you need to mark it dirty as well. Made the depot windows use WE_INVALIDATE_DATA to set when to generate the engine and wagon lists instead of at each redraw It makes no sense to regenerate the list when say using the scrollbar if we know that no vehicle have entered or left the list NOTE: currently there is a piece of code to generate the list when it's not needed and compare it to the stored list and assert if they mismatch This check is somewhat slow and kills the whole idea of WE_INVALIDATE_DATA, so it's a short lived one to verify that InvalidateWindowData() is used everywhere where it's needed
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 206b9cbad..51b3a979b 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -2005,6 +2005,7 @@ 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);
v->tile = tile;