mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r3049) Replace byte/int/uint by RailType where appropriate
This commit is contained in:
parent
ab657338ec
commit
66bf4f863d
|
@ -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);
|
||||
|
||||
|
|
2
gui.h
2
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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
2
player.h
2
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;
|
||||
|
|
2
rail.h
2
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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
12
rail_gui.c
12
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue