mirror of https://github.com/OpenTTD/OpenTTD
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
parent
50f1a93664
commit
ff30404170
|
@ -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;
|
||||
|
||||
|
|
9
gui.h
9
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);
|
||||
|
|
17
main_gui.c
17
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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue