(svn r6370) -Codechange: moved all the remaining setup for PlayerVehWndProc() into WE_CREATE
authorbjarni
Sun, 03 Sep 2006 23:14:39 +0000
changeset 4541 9cee87cdd613
parent 4540 2f70d57828e1
child 4542 24f60077489a
(svn r6370) -Codechange: moved all the remaining setup for PlayerVehWndProc() into WE_CREATE
aircraft_gui.c
roadveh_gui.c
ship_gui.c
train_gui.c
vehicle_gui.c
--- a/aircraft_gui.c	Sun Sep 03 23:02:42 2006 +0000
+++ b/aircraft_gui.c	Sun Sep 03 23:14:39 2006 +0000
@@ -1034,12 +1034,6 @@
 			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)
--- a/roadveh_gui.c	Sun Sep 03 23:02:42 2006 +0000
+++ b/roadveh_gui.c	Sun Sep 03 23:14:39 2006 +0000
@@ -963,13 +963,6 @@
 			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)
--- a/ship_gui.c	Sun Sep 03 23:02:42 2006 +0000
+++ b/ship_gui.c	Sun Sep 03 23:14:39 2006 +0000
@@ -976,12 +976,6 @@
 			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)
--- a/train_gui.c	Sun Sep 03 23:02:42 2006 +0000
+++ b/train_gui.c	Sun Sep 03 23:14:39 2006 +0000
@@ -1434,15 +1434,6 @@
 			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)
--- a/vehicle_gui.c	Sun Sep 03 23:02:42 2006 +0000
+++ b/vehicle_gui.c	Sun Sep 03 23:14:39 2006 +0000
@@ -1365,6 +1365,8 @@
 			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 @@
 					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;