summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aircraft_gui.c8
-rw-r--r--gui.h9
-rw-r--r--main_gui.c17
-rw-r--r--roadveh_gui.c8
-rw-r--r--ship_gui.c8
-rw-r--r--train_gui.c8
-rw-r--r--vehicle_gui.c5
-rw-r--r--vehicle_gui.h3
8 files changed, 35 insertions, 31 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 8d20e6dfd..234a94ff5 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -1011,8 +1011,8 @@ static const Widget _other_player_aircraft_widgets[] = {
static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
{
- int station = (int)w->window_number >> 16;
- int owner = w->window_number & 0xff;
+ StationID station = GB(w->window_number, 16, 16);
+ PlayerID owner = GB(w->window_number, 0, 8);
vehiclelist_d *vl = &WP(w, vehiclelist_d);
switch(e->event) {
@@ -1034,7 +1034,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
/* draw the widgets */
{
const Player *p = GetPlayer(owner);
- if (station == -1) {
+ if (station == INVALID_STATION) {
/* Company Name -- (###) Aircraft */
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
@@ -1207,7 +1207,7 @@ static const WindowDesc _other_player_aircraft_desc = {
PlayerAircraftWndProc
};
-void ShowPlayerAircraft(int player, int station)
+void ShowPlayerAircraft(PlayerID player, StationID station)
{
Window *w;
diff --git a/gui.h b/gui.h
index 9118ff695..6090b1489 100644
--- a/gui.h
+++ b/gui.h
@@ -3,6 +3,7 @@
#ifndef GUI_H
#define GUI_H
+#include "station.h"
#include "window.h"
/* main_gui.c */
@@ -38,7 +39,7 @@ void ShowBuildRailToolbar(int index, int button);
void PlaceProc_BuyLand(TileIndex tile);
/* train_gui.c */
-void ShowPlayerTrains(int player, int station);
+void ShowPlayerTrains(PlayerID player, StationID station);
void ShowTrainViewWindow(Vehicle *v);
void ShowTrainDetailsWindow(Vehicle *v);
void ShowOrdersWindow(Vehicle *v);
@@ -48,17 +49,17 @@ void ShowRoadVehViewWindow(Vehicle *v);
/* road_gui.c */
void ShowBuildRoadToolbar(void);
void ShowBuildRoadScenToolbar(void);
-void ShowPlayerRoadVehicles(int player, int station);
+void ShowPlayerRoadVehicles(PlayerID player, StationID station);
/* dock_gui.c */
void ShowBuildDocksToolbar(void);
-void ShowPlayerShips(int player, int station);
+void ShowPlayerShips(PlayerID player, StationID station);
void ShowShipViewWindow(Vehicle *v);
/* aircraft_gui.c */
void ShowBuildAirToolbar(void);
-void ShowPlayerAircraft(int player, int station);
+void ShowPlayerAircraft(PlayerID player, StationID station);
/* terraform_gui.c */
void ShowTerraformToolbar(void);
diff --git a/main_gui.c b/main_gui.c
index 1f1dd1076..543b4c7e2 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -5,6 +5,7 @@
#include "currency.h"
#include "functions.h"
#include "spritecache.h"
+#include "station.h"
#include "strings.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -306,22 +307,22 @@ static void MenuClickIndustry(int index)
static void MenuClickShowTrains(int index)
{
- ShowPlayerTrains(index, -1);
+ ShowPlayerTrains(index, INVALID_STATION);
}
static void MenuClickShowRoad(int index)
{
- ShowPlayerRoadVehicles(index, -1);
+ ShowPlayerRoadVehicles(index, INVALID_STATION);
}
static void MenuClickShowShips(int index)
{
- ShowPlayerShips(index, -1);
+ ShowPlayerShips(index, INVALID_STATION);
}
static void MenuClickShowAir(int index)
{
- ShowPlayerAircraft(index, -1);
+ ShowPlayerAircraft(index, INVALID_STATION);
}
static void MenuClickBuildRail(int index)
@@ -1906,10 +1907,10 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
case WKC_F10:ShowOperatingProfitGraph(); break;
case WKC_F11: ShowCompanyLeagueTable(); break;
case WKC_F12: ShowBuildIndustryWindow(); break;
- case WKC_SHIFT | WKC_F1: ShowPlayerTrains(local, -1); break;
- case WKC_SHIFT | WKC_F2: ShowPlayerRoadVehicles(local, -1); break;
- case WKC_SHIFT | WKC_F3: ShowPlayerShips(local, -1); break;
- case WKC_SHIFT | WKC_F4: ShowPlayerAircraft(local, -1); break;
+ case WKC_SHIFT | WKC_F1: ShowPlayerTrains(local, INVALID_STATION); break;
+ case WKC_SHIFT | WKC_F2: ShowPlayerRoadVehicles(local, INVALID_STATION); break;
+ case WKC_SHIFT | WKC_F3: ShowPlayerShips(local, INVALID_STATION); break;
+ case WKC_SHIFT | WKC_F4: ShowPlayerAircraft(local, INVALID_STATION); break;
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break;
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break;
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype,-1); break;
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 167e17ef7..e107dc2d4 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -886,8 +886,8 @@ static const Widget _other_player_roadveh_widgets[] = {
static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
{
- int station = (int)w->window_number >> 16;
- int owner = w->window_number & 0xff;
+ StationID station = GB(w->window_number, 16, 16);
+ PlayerID owner = GB(w->window_number, 0, 8);
vehiclelist_d *vl = &WP(w, vehiclelist_d);
switch(e->event) {
@@ -909,7 +909,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
/* draw the widgets */
{
const Player *p = GetPlayer(owner);
- if (station == -1) {
+ if (station == INVALID_STATION) {
/* Company Name -- (###) Road vehicles */
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
@@ -1079,7 +1079,7 @@ static const WindowDesc _other_player_roadveh_desc = {
};
-void ShowPlayerRoadVehicles(int player, int station)
+void ShowPlayerRoadVehicles(PlayerID player, StationID station)
{
Window *w;
diff --git a/ship_gui.c b/ship_gui.c
index 8362d8409..aa522a574 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -990,8 +990,8 @@ static const Widget _other_player_ships_widgets[] = {
static void PlayerShipsWndProc(Window *w, WindowEvent *e)
{
- int station = (int)w->window_number >> 16;
- int owner = w->window_number & 0xff;
+ StationID station = GB(w->window_number, 16, 16);
+ PlayerID owner = GB(w->window_number, 0, 8);
vehiclelist_d *vl = &WP(w, vehiclelist_d);
switch(e->event) {
@@ -1013,7 +1013,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
/* draw the widgets */
{
const Player *p = GetPlayer(owner);
- if (station == -1) {
+ if (station == INVALID_STATION) {
/* Company Name -- (###) Trains */
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
@@ -1186,7 +1186,7 @@ static const WindowDesc _other_player_ships_desc = {
};
-void ShowPlayerShips(int player, int station)
+void ShowPlayerShips(PlayerID player, StationID station)
{
Window *w;
diff --git a/train_gui.c b/train_gui.c
index 3c02fa561..08b4a15f6 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1370,8 +1370,8 @@ static const Widget _other_player_trains_widgets[] = {
static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
{
- int station = (int)w->window_number >> 16;
- int owner = w->window_number & 0xff;
+ StationID station = GB(w->window_number, 16, 16);
+ PlayerID owner = GB(w->window_number, 0, 8);
vehiclelist_d *vl = &WP(w, vehiclelist_d);
switch(e->event) {
@@ -1393,7 +1393,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
/* draw the widgets */
{
const Player *p = GetPlayer(owner);
- if (station == -1) {
+ if (station == INVALID_STATION) {
/* Company Name -- (###) Trains */
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
@@ -1567,7 +1567,7 @@ static const WindowDesc _other_player_trains_desc = {
PlayerTrainsWndProc
};
-void ShowPlayerTrains(int player, int station)
+void ShowPlayerTrains(PlayerID player, StationID station)
{
Window *w;
diff --git a/vehicle_gui.c b/vehicle_gui.c
index eba37916c..93da38d3f 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -5,6 +5,7 @@
#include "debug.h"
#include "functions.h"
#include "player.h"
+#include "station.h"
#include "strings.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -101,7 +102,7 @@ void ResortVehicleLists(void)
}
}
-void BuildVehicleList(vehiclelist_d *vl, int type, int owner, int station)
+void BuildVehicleList(vehiclelist_d* vl, int type, PlayerID owner, StationID station)
{
int subtype = (type != VEH_Aircraft) ? TS_Front_Engine : 2;
int n = 0;
@@ -117,7 +118,7 @@ void BuildVehicleList(vehiclelist_d *vl, int type, int owner, int station)
DEBUG(misc, 1) ("Building vehicle list for player %d station %d...",
owner, station);
- if (station != -1) {
+ if (station != INVALID_STATION) {
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (v->type == type && v->subtype <= subtype) {
diff --git a/vehicle_gui.h b/vehicle_gui.h
index 0b93ceafd..f6929fe2f 100644
--- a/vehicle_gui.h
+++ b/vehicle_gui.h
@@ -3,6 +3,7 @@
#ifndef VEHICLE_GUI_H
#define VEHICLE_GUI_H
+#include "station.h"
#include "vehicle.h"
struct vehiclelist_d;
@@ -15,7 +16,7 @@ void InitializeVehiclesGuiList(void);
void RebuildVehicleLists(void);
void ResortVehicleLists(void);
-void BuildVehicleList(struct vehiclelist_d *vl, int type, int owner, int station);
+void BuildVehicleList(struct vehiclelist_d* vl, int type, PlayerID, StationID);
void SortVehicleList(struct vehiclelist_d *vl);
int CDECL GeneralOwnerSorter(const void *a, const void *b);