(svn r6167) -Code cleanup r6161: replaced some uint16 with OrderID and (1 << 8) with SHARE_FLAG
authorbjarni
Sun, 27 Aug 2006 09:55:54 +0000
changeset 4414 b7bdfeaa4631
parent 4413 a65fe514b429
child 4415 720570b96364
(svn r6167) -Code cleanup r6161: replaced some uint16 with OrderID and (1 << 8) with SHARE_FLAG
aircraft_gui.c
order.h
roadveh_gui.c
ship_gui.c
train_gui.c
vehicle_gui.c
--- a/aircraft_gui.c	Sun Aug 27 09:50:43 2006 +0000
+++ b/aircraft_gui.c	Sun Aug 27 09:55:54 2006 +0000
@@ -1009,10 +1009,10 @@
 
 static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
 {
-	uint16 order = GB(w->window_number, 16, 16);
+	OrderID order = GB(w->window_number, 16, 16);
 	/* Sorting a shared order list relies on station being set to INVALID_STATION */
 	/* If station is not INVALID_STATION, then order is never used and we don't care what it contains */
-	StationID station = HASBIT(w->window_number, 8) ? INVALID_STATION : order;
+	StationID station = (w->window_number & SHARE_FLAG) ? INVALID_STATION : order;
 	PlayerID owner = GB(w->window_number, 0, 8);
 	vehiclelist_d *vl = &WP(w, vehiclelist_d);
 
@@ -1194,12 +1194,12 @@
 	PlayerAircraftWndProc
 };
 
-void ShowPlayerAircraftLocal(PlayerID player, StationID station, uint16 order, bool show_shared)
+void ShowPlayerAircraftLocal(PlayerID player, StationID station, OrderID order, bool show_shared)
 {
 	Window *w;
 
 	if (show_shared) {
-		w = AllocateWindowDescFront(&_player_aircraft_desc, (order << 16) | (1 << 8));
+		w = AllocateWindowDescFront(&_player_aircraft_desc, (order << 16) | SHARE_FLAG);
 	} else {
 		if (player == _local_player) {
 			w = AllocateWindowDescFront(&_player_aircraft_desc, (station << 16) | player);
--- a/order.h	Sun Aug 27 09:50:43 2006 +0000
+++ b/order.h	Sun Aug 27 09:55:54 2006 +0000
@@ -11,6 +11,7 @@
 
 enum {
 	INVALID_ORDER = 0xFFFF,
+	SHARE_FLAG    = 1 << 8,
 };
 
 /* Order types */
--- a/roadveh_gui.c	Sun Aug 27 09:50:43 2006 +0000
+++ b/roadveh_gui.c	Sun Aug 27 09:55:54 2006 +0000
@@ -947,10 +947,10 @@
 
 static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
 {
-	uint16 order = GB(w->window_number, 16, 16);
+	OrderID order = GB(w->window_number, 16, 16);
 	/* Sorting a shared order list relies on station being set to INVALID_STATION */
 	/* If station is not INVALID_STATION, then order is never used and we don't care what it contains */
-	StationID station = HASBIT(w->window_number, 8) ? INVALID_STATION : order;
+	StationID station = (w->window_number & SHARE_FLAG) ? INVALID_STATION : order;
 	PlayerID owner = GB(w->window_number, 0, 8);
 	vehiclelist_d *vl = &WP(w, vehiclelist_d);
 
@@ -1128,12 +1128,12 @@
 };
 
 
-static void ShowPlayerRoadVehiclesLocal(PlayerID player, StationID station, uint16 order, bool show_shared)
+static void ShowPlayerRoadVehiclesLocal(PlayerID player, StationID station, OrderID order, bool show_shared)
 {
 	Window *w;
 
 	if (show_shared) {
-		w = AllocateWindowDescFront(&_player_roadveh_desc, (order << 16) | (1 << 8));
+		w = AllocateWindowDescFront(&_player_roadveh_desc, (order << 16) | SHARE_FLAG);
 	} else {
 		if ( player == _local_player) {
 			w = AllocateWindowDescFront(&_player_roadveh_desc, (station << 16) | player);
--- a/ship_gui.c	Sun Aug 27 09:50:43 2006 +0000
+++ b/ship_gui.c	Sun Aug 27 09:55:54 2006 +0000
@@ -956,10 +956,10 @@
 
 static void PlayerShipsWndProc(Window *w, WindowEvent *e)
 {
-	uint16 order = GB(w->window_number, 16, 16);
+	OrderID order = GB(w->window_number, 16, 16);
 	/* Sorting a shared order list relies on station being set to INVALID_STATION */
 	/* If station is not INVALID_STATION, then order is never used and we don't care what it contains */
-	StationID station = HASBIT(w->window_number, 8) ? INVALID_STATION : order;
+	StationID station = (w->window_number & SHARE_FLAG) ? INVALID_STATION : order;
 	PlayerID owner = GB(w->window_number, 0, 8);
 	vehiclelist_d *vl = &WP(w, vehiclelist_d);
 
@@ -1142,7 +1142,7 @@
 };
 
 
-static void ShowPlayerShipsLocal(PlayerID player, StationID station, uint16 order, bool show_shared)
+static void ShowPlayerShipsLocal(PlayerID player, StationID station, OrderID order, bool show_shared)
 {
 	Window *w;
 
--- a/train_gui.c	Sun Aug 27 09:50:43 2006 +0000
+++ b/train_gui.c	Sun Aug 27 09:55:54 2006 +0000
@@ -1406,10 +1406,10 @@
 
 static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
 {
-	uint16 order = GB(w->window_number, 16, 16);
+	OrderID order = GB(w->window_number, 16, 16);
 	/* Sorting a shared order list relies on station being set to INVALID_STATION */
 	/* If station is not INVALID_STATION, then order is never used and we don't care what it contains */
-	StationID station = HASBIT(w->window_number, 8) ? INVALID_STATION : order;
+	StationID station = (w->window_number & SHARE_FLAG) ? INVALID_STATION : order;
 	PlayerID owner = GB(w->window_number, 0, 8);
 	vehiclelist_d *vl = &WP(w, vehiclelist_d);
 
@@ -1591,12 +1591,12 @@
 	PlayerTrainsWndProc
 };
 
-static void ShowPlayerTrainsLocal(PlayerID player, StationID station, uint16 order, bool show_shared)
+static void ShowPlayerTrainsLocal(PlayerID player, StationID station, OrderID order, bool show_shared)
 {
 	Window *w;
 
 	if (show_shared) {
-		w = AllocateWindowDescFront(&_player_trains_desc, (order << 16) | (1 << 8));
+		w = AllocateWindowDescFront(&_player_trains_desc, (order << 16) | SHARE_FLAG);
 	} else {
 		if (player == _local_player) {
 			w = AllocateWindowDescFront(&_player_trains_desc, (station << 16) | player);
--- a/vehicle_gui.c	Sun Aug 27 09:50:43 2006 +0000
+++ b/vehicle_gui.c	Sun Aug 27 09:55:54 2006 +0000
@@ -115,7 +115,7 @@
 		}
 }
 
-void BuildVehicleList(vehiclelist_d* vl, int type, PlayerID owner, StationID station, uint16 order)
+void BuildVehicleList(vehiclelist_d* vl, int type, PlayerID owner, StationID station, OrderID order)
 {
 	const Vehicle** sort_list;
 	uint subtype = (type != VEH_Aircraft) ? Train_Front : 2;