summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-03 23:14:39 +0000
committerbjarni <bjarni@openttd.org>2006-09-03 23:14:39 +0000
commite42d819b6aa6ae343968b52cfd8567bcd0300ab8 (patch)
tree817487db0395cb7c4520782b36843e4071fa6934
parent7ab6ae3a21454bf7eb51ed9fea3bed2362b85996 (diff)
downloadopenttd-e42d819b6aa6ae343968b52cfd8567bcd0300ab8.tar.xz
(svn r6370) -Codechange: moved all the remaining setup for PlayerVehWndProc() into WE_CREATE
-rw-r--r--aircraft_gui.c6
-rw-r--r--roadveh_gui.c7
-rw-r--r--ship_gui.c6
-rw-r--r--train_gui.c9
-rw-r--r--vehicle_gui.c13
5 files changed, 13 insertions, 28 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 7bbb04855..d3b5aa4fe 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -1034,12 +1034,6 @@ void ShowPlayerAircraftLocal(PlayerID player, StationID station, OrderID order,
w = AllocateWindowDescFront(&_other_player_aircraft_desc, (station << 16) | (VEH_Aircraft << 11) | VLW_flag | player);
}
}
-
- if (w != NULL) {
- w->vscroll.cap = 4;
- w->widget[7].unkA = (w->vscroll.cap << 8) + 1;
- w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG;
- }
}
void ShowPlayerAircraft(PlayerID player, StationID station)
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 77ba1fb51..b8600f7a9 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -963,13 +963,6 @@ static void ShowPlayerRoadVehiclesLocal(PlayerID player, StationID station, Orde
w = AllocateWindowDescFront(&_other_player_roadveh_desc, (station << 16) | (VEH_Road << 11) | VLW_flag | player);
}
}
-
- if (w != NULL) {
- w->vscroll.cap = 7; // maximum number of vehicles shown
- w->widget[7].unkA = (w->vscroll.cap << 8) + 1;
- w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL;
- w->resize.height = 220 - (PLY_WND_PRC__SIZE_OF_ROW_SMALL * 3); /* Minimum of 4 vehicles */
- }
}
void ShowPlayerRoadVehicles(PlayerID player, StationID station)
diff --git a/ship_gui.c b/ship_gui.c
index 39d40b5e4..6e209dfdb 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -976,12 +976,6 @@ static void ShowPlayerShipsLocal(PlayerID player, StationID station, OrderID ord
w = AllocateWindowDescFront(&_other_player_ships_desc, (station << 16) | (VEH_Ship << 11) | VLW_flag | player);
}
}
-
- if (w != NULL) {
- w->vscroll.cap = 4;
- w->widget[7].unkA = (w->vscroll.cap << 8) + 1;
- w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG;
- }
}
void ShowPlayerShips(PlayerID player, StationID station)
diff --git a/train_gui.c b/train_gui.c
index 6527570f9..77a014b5d 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1434,15 +1434,6 @@ static void ShowPlayerTrainsLocal(PlayerID player, StationID station, OrderID or
w = AllocateWindowDescFront(&_other_player_trains_desc, (station << 16) | (VEH_Train << 11) | VLW_flag | player);
}
}
-
- if (w != NULL) {
- w->hscroll.cap = 10 * 29;
- w->vscroll.cap = 7; // maximum number of vehicles shown
- w->widget[7].unkA = (w->vscroll.cap << 8) + 1;
- w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL;
- w->resize.step_width = 1;
- w->resize.height = 220 - (PLY_WND_PRC__SIZE_OF_ROW_SMALL * 3); /* Minimum of 4 vehicles */
- }
}
void ShowPlayerTrains(PlayerID player, StationID station)
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 3ea45943b..a130d89d1 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -1365,6 +1365,8 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
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:
+ w->hscroll.cap = 10 * 29;
+ w->resize.step_width = 1;
vl->flags = VL_REBUILD | (_sorting.train.order << (VL_DESC - 1));
vl->sort_type = _sorting.train.criteria;
break;
@@ -1382,6 +1384,17 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
break;
default: NOT_REACHED(); break;
}
+
+ if (vehicle_type == VEH_Ship || vehicle_type == VEH_Aircraft) {
+ w->vscroll.cap = 4;
+ w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG;
+ } else {
+ w->vscroll.cap = 7;
+ w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL;
+ w->resize.height = 220 - (PLY_WND_PRC__SIZE_OF_ROW_SMALL * 3); // Minimum of 4 vehicles
+ }
+
+ w->widget[7].unkA = (w->vscroll.cap << 8) + 1;
vl->sort_list = NULL;
vl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; // Set up resort timer
break;