summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-08-27 09:55:54 +0000
committerbjarni <bjarni@openttd.org>2006-08-27 09:55:54 +0000
commit27534b352198f6c9c3eca51493f5685eb0e74b60 (patch)
treebc81977b36ba2b51906c35b5c658a0f08fde338a
parent13addec466543de725df9d40e8500af735b6816e (diff)
downloadopenttd-27534b352198f6c9c3eca51493f5685eb0e74b60.tar.xz
(svn r6167) -Code cleanup r6161: replaced some uint16 with OrderID and (1 << 8) with SHARE_FLAG
-rw-r--r--aircraft_gui.c8
-rw-r--r--order.h1
-rw-r--r--roadveh_gui.c8
-rw-r--r--ship_gui.c6
-rw-r--r--train_gui.c8
-rw-r--r--vehicle_gui.c2
6 files changed, 17 insertions, 16 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 05fc7cd83..8d77e6ec4 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -1009,10 +1009,10 @@ static const Widget _other_player_aircraft_widgets[] = {
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 @@ static const WindowDesc _other_player_aircraft_desc = {
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);
diff --git a/order.h b/order.h
index f60a6b2ac..857aaa1dd 100644
--- a/order.h
+++ b/order.h
@@ -11,6 +11,7 @@
enum {
INVALID_ORDER = 0xFFFF,
+ SHARE_FLAG = 1 << 8,
};
/* Order types */
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 64bddc8a0..536ecb47e 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -947,10 +947,10 @@ static const Widget _other_player_roadveh_widgets[] = {
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 const WindowDesc _other_player_roadveh_desc = {
};
-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);
diff --git a/ship_gui.c b/ship_gui.c
index bcaa8869d..01ae5f803 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -956,10 +956,10 @@ static const Widget _other_player_ships_widgets[] = {
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 const WindowDesc _other_player_ships_desc = {
};
-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;
diff --git a/train_gui.c b/train_gui.c
index 609434199..ae1759cf4 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1406,10 +1406,10 @@ static const Widget _other_player_trains_widgets[] = {
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 @@ static const WindowDesc _other_player_trains_desc = {
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);
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 9ac1d4e6f..bc630e47e 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -115,7 +115,7 @@ void ResortVehicleLists(void)
}
}
-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;