diff options
author | bjarni <bjarni@openttd.org> | 2006-09-02 21:16:46 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-09-02 21:16:46 +0000 |
commit | 0fc0586bbff1dbb509a09d2a920f3284834bcc93 (patch) | |
tree | e78b80caa54c8d67473068ad6fa518793dad3efd /vehicle_gui.c | |
parent | da30222a912b535e20130e31013996fb9ff7f6de (diff) | |
download | openttd-0fc0586bbff1dbb509a09d2a920f3284834bcc93.tar.xz |
(svn r6350) -Codechange: moved some setup stuff into WE_CREATE in PlayerVehWndProc()
This is possible now that the window number is known when running WE_CREATE and it's a nicer solution
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r-- | vehicle_gui.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c index 6332da25b..3ea45943b 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1362,8 +1362,26 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) break; case WE_CREATE: - /* IMPORTANT: order and criteria needs to be set after the window is created, but before it's used */ - /* w->window_number is not yet set at this point, so we lack info on what kind of vehicle we are dealing with */ + w->caption_color = GB(w->window_number, 0, 8); // OwnerID is stored in the last 8 bits of the window number + switch (vehicle_type) { + case VEH_Train: + vl->flags = VL_REBUILD | (_sorting.train.order << (VL_DESC - 1)); + vl->sort_type = _sorting.train.criteria; + break; + case VEH_Road: + vl->flags = VL_REBUILD | (_sorting.roadveh.order << (VL_DESC - 1)); + vl->sort_type = _sorting.roadveh.criteria; + break; + case VEH_Ship: + vl->flags = VL_REBUILD | (_sorting.ship.order << (VL_DESC - 1)); + vl->sort_type = _sorting.ship.criteria; + break; + case VEH_Aircraft: + vl->flags = VL_REBUILD | (_sorting.aircraft.order << (VL_DESC - 1)); + vl->sort_type = _sorting.aircraft.criteria; + break; + default: NOT_REACHED(); break; + } vl->sort_list = NULL; vl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; // Set up resort timer break; |