summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions.h7
-rw-r--r--gui.h2
-rw-r--r--main_gui.c2
-rw-r--r--player.h2
-rw-r--r--rail.h2
-rw-r--r--rail_cmd.c4
-rw-r--r--rail_gui.c12
-rw-r--r--station.h3
-rw-r--r--station_cmd.c4
-rw-r--r--train_gui.c6
-rw-r--r--vehicle_gui.c8
-rw-r--r--waypoint.c2
-rw-r--r--waypoint.h2
13 files changed, 27 insertions, 29 deletions
diff --git a/functions.h b/functions.h
index d5fcd6c50..a73a828ef 100644
--- a/functions.h
+++ b/functions.h
@@ -55,13 +55,6 @@ void DrawClearLandTile(const TileInfo *ti, byte set);
void DrawClearLandFence(const TileInfo *ti);
void TileLoopClearHelper(TileIndex tile);
-/* station_land.c */
-void StationPickerDrawSprite(int x, int y, int railtype, int image);
-
-/* track_land.c */
-void DrawTrainDepotSprite(int x, int y, int image, int railtype);
-void DrawDefaultWaypointSprite(int x, int y, int railtype);
-
/* road_land.c */
void DrawRoadDepotSprite(int x, int y, int image);
diff --git a/gui.h b/gui.h
index 823111c8d..4867cacf8 100644
--- a/gui.h
+++ b/gui.h
@@ -35,7 +35,7 @@ void ShowMessageOptions(void);
void ShowMessageHistory(void);
/* traintoolb_gui.c */
-void ShowBuildRailToolbar(int index, int button);
+void ShowBuildRailToolbar(RailType railtype, int button);
void PlaceProc_BuyLand(TileIndex tile);
/* train_gui.c */
diff --git a/main_gui.c b/main_gui.c
index 9ccfb5bdd..5f151b219 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -39,7 +39,7 @@ static int _rename_id;
static int _rename_what;
static byte _terraform_size = 1;
-static byte _last_built_railtype;
+static RailType _last_built_railtype;
extern void GenerateWorld(int mode, uint size_x, uint size_y);
extern void GenerateIndustries(void);
diff --git a/player.h b/player.h
index 88a5ba7e4..82a15a6db 100644
--- a/player.h
+++ b/player.h
@@ -253,7 +253,7 @@ static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_curr
* @param p the player "in action"
* @return The "best" railtype a player has available
*/
-static inline byte GetBestRailtype(const Player *p)
+static inline RailType GetBestRailtype(const Player* p)
{
if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV;
if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO;
diff --git a/rail.h b/rail.h
index ba5025dbe..8632fe368 100644
--- a/rail.h
+++ b/rail.h
@@ -590,5 +590,7 @@ static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
}
void DrawTrackBits(TileInfo *ti, TrackBits track, bool earth, bool snow, bool flat);
+void DrawTrainDepotSprite(int x, int y, int image, RailType railtype);
+void DrawDefaultWaypointSprite(int x, int y, RailType railtype);
#endif /* RAIL_H */
diff --git a/rail_cmd.c b/rail_cmd.c
index fec972c90..e185d8529 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1584,7 +1584,7 @@ static void DrawTile_Track(TileInfo *ti)
}
}
-void DrawTrainDepotSprite(int x, int y, int image, int railtype)
+void DrawTrainDepotSprite(int x, int y, int image, RailType railtype)
{
uint32 ormod, img;
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
@@ -1611,7 +1611,7 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
}
}
-void DrawDefaultWaypointSprite(int x, int y, int railtype)
+void DrawDefaultWaypointSprite(int x, int y, RailType railtype)
{
const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
diff --git a/rail_gui.c b/rail_gui.c
index a541ff789..e3f929ec2 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -21,7 +21,7 @@
#include "debug.h"
#include "variables.h"
-static uint _cur_railtype;
+static RailType _cur_railtype;
static bool _remove_button_clicked;
static byte _build_depot_direction;
static byte _waypoint_count=1;
@@ -539,7 +539,7 @@ typedef enum {
* @param railtype the railtype to display
* @param w the window to modify
*/
-static void SetupRailToolbar(uint16 railtype, Window *w)
+static void SetupRailToolbar(RailType railtype, Window *w)
{
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
@@ -555,7 +555,7 @@ static void SetupRailToolbar(uint16 railtype, Window *w)
w->widget[RTW_BUILD_TUNNEL].unkA = rti->gui_sprites.build_tunnel;
}
-void ShowBuildRailToolbar(int index, int button)
+void ShowBuildRailToolbar(RailType railtype, int button)
{
Window *w;
@@ -564,9 +564,9 @@ void ShowBuildRailToolbar(int index, int button)
// don't recreate the window if we're clicking on a button and the window exists.
if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, 0)) || w->wndproc != BuildRailToolbWndProc) {
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
- _cur_railtype = (byte)index;
+ _cur_railtype = railtype;
w = AllocateWindowDesc(&_build_rail_desc);
- SetupRailToolbar( (byte) index, w);
+ SetupRailToolbar(railtype, w);
}
_remove_button_clicked = false;
@@ -763,7 +763,7 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
case WE_PAINT: {
- int r;
+ RailType r;
w->click_state = (1 << 3) << _build_depot_direction;
DrawWindowWidgets(w);
diff --git a/station.h b/station.h
index f7d7850ac..1483981f2 100644
--- a/station.h
+++ b/station.h
@@ -193,6 +193,9 @@ void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int
uint GetStationPlatforms(const Station *st, TileIndex tile);
+void StationPickerDrawSprite(int x, int y, RailType railtype, int image);
+
+
/* Station layout for given dimensions - it is a two-dimensional array
* where index is computed as (x * platforms) + platform. */
typedef byte *StationLayout;
diff --git a/station_cmd.c b/station_cmd.c
index 612151dbc..66698a073 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2131,7 +2131,7 @@ static void DrawTile_Station(TileInfo *ti)
uint32 image;
const DrawTileSeqStruct *dtss;
const DrawTileSprites *t = NULL;
- byte railtype = GB(_m[ti->tile].m3, 0, 4);
+ RailType railtype = GB(_m[ti->tile].m3, 0, 4);
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
SpriteID offset;
uint32 relocation = 0;
@@ -2203,7 +2203,7 @@ static void DrawTile_Station(TileInfo *ti)
}
}
-void StationPickerDrawSprite(int x, int y, int railtype, int image)
+void StationPickerDrawSprite(int x, int y, RailType railtype, int image)
{
uint32 ormod, img;
const DrawTileSeqStruct *dtss;
diff --git a/train_gui.c b/train_gui.c
index 257707517..8655725df 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -173,7 +173,7 @@ void CcCloneTrain(bool success, uint tile, uint32 p1, uint32 p2)
}
static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
- EngineID* selected_id, byte railtype, byte show_max, bool is_engine)
+ EngineID* selected_id, RailType railtype, byte show_max, bool is_engine)
{
EngineID i;
@@ -208,7 +208,7 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
{
int count = 0;
- byte railtype = WP(w,buildtrain_d).railtype;
+ RailType railtype = WP(w,buildtrain_d).railtype;
EngineID i;
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
@@ -224,7 +224,7 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
{
- byte railtype = WP(w,buildtrain_d).railtype;
+ RailType railtype = WP(w,buildtrain_d).railtype;
int sel = WP(w,buildtrain_d).sel_index;
int pos = w->vscroll.pos;
int x = 1;
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 77a872752..b7a03acf8 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -25,7 +25,7 @@ static uint32 _last_vehicle_idx; // cached index to hopefully speed up na
static bool _internal_sort_order; // descending/ascending
static uint16 _player_num_engines[256];
-static byte _railtype_selected_in_replace_gui;
+static RailType _railtype_selected_in_replace_gui;
typedef int CDECL VehicleSortListingTypeFunction(const void*, const void*);
@@ -414,7 +414,7 @@ static int CDECL VehicleMaxSpeedSorter(const void *a, const void *b)
/* if show_outdated is selected, it do not sort psudo engines properly but it draws all engines
* if used compined with show_cars set to false, it will work as intended. Replace window do it like that
* this was a big hack even before show_outdated was added. Stupid newgrf :p */
-static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, int *selected_id, byte railtype,
+static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, int *selected_id, RailType railtype,
uint8 lines_drawn, bool is_engine, bool show_cars, bool show_outdated)
{
EngineID i;
@@ -462,7 +462,7 @@ static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, int *s
static void SetupScrollStuffForReplaceWindow(Window *w)
{
- byte railtype;
+ RailType railtype;
int selected_id[2] = {-1,-1};
int sel[2];
int count = 0;
@@ -625,7 +625,7 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
switch (WP(w,replaceveh_d).vehicletype) {
case VEH_Train: {
- byte railtype = _railtype_selected_in_replace_gui;
+ RailType railtype = _railtype_selected_in_replace_gui;
DrawString(157, 99 + (14 * w->vscroll.cap), _rail_types_list[railtype], 0x10);
/* draw sorting criteria string */
diff --git a/waypoint.c b/waypoint.c
index 5ffd9791c..a2e46fdf8 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -360,7 +360,7 @@ extern uint16 _custom_sprites_base;
/* Draw a waypoint */
-void DrawWaypointSprite(int x, int y, int stat_id, uint railtype)
+void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
{
StationSpec *stat;
uint32 relocation;
diff --git a/waypoint.h b/waypoint.h
index 57b280b7e..537d86e69 100644
--- a/waypoint.h
+++ b/waypoint.h
@@ -59,7 +59,7 @@ int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove);
Station *ComposeWaypointStation(TileIndex tile);
Waypoint *GetWaypointByTile(TileIndex tile);
void ShowRenameWaypointWindow(const Waypoint *cp);
-void DrawWaypointSprite(int x, int y, int image, uint railtype);
+void DrawWaypointSprite(int x, int y, int image, RailType railtype);
void UpdateWaypointSign(Waypoint *cp);
void FixOldWaypoints(void);
void UpdateAllWaypointSigns(void);