mirror of https://github.com/OpenTTD/OpenTTD
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
parent
b0ca38e20a
commit
310170364f
17
src/rail.h
17
src/rail.h
|
@ -13,6 +13,16 @@
|
||||||
#include "economy_func.h"
|
#include "economy_func.h"
|
||||||
#include "tile_cmd.h"
|
#include "tile_cmd.h"
|
||||||
|
|
||||||
|
enum RailTypeFlag {
|
||||||
|
RTF_CATENARY = 0, ///< Set if the rail type should have catenary drawn
|
||||||
|
};
|
||||||
|
|
||||||
|
enum RailTypeFlags {
|
||||||
|
RTFB_NONE = 0,
|
||||||
|
RTFB_CATENARY = 1 << RTF_CATENARY,
|
||||||
|
};
|
||||||
|
DECLARE_ENUM_AS_BIT_SET(RailTypeFlags);
|
||||||
|
|
||||||
/** This struct contains all the info that is needed to draw and construct tracks.
|
/** This struct contains all the info that is needed to draw and construct tracks.
|
||||||
*/
|
*/
|
||||||
struct RailtypeInfo {
|
struct RailtypeInfo {
|
||||||
|
@ -93,6 +103,11 @@ struct RailtypeInfo {
|
||||||
* Multiplier for curve maximum speed advantage
|
* Multiplier for curve maximum speed advantage
|
||||||
*/
|
*/
|
||||||
byte curve_speed;
|
byte curve_speed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bit mask of rail type flags
|
||||||
|
*/
|
||||||
|
RailTypeFlags flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,7 +205,7 @@ int TicksToLeaveDepot(const Vehicle *v);
|
||||||
*/
|
*/
|
||||||
static inline bool HasCatenary(RailType rt)
|
static inline bool HasCatenary(RailType rt)
|
||||||
{
|
{
|
||||||
return rt == RAILTYPE_ELECTRIC;
|
return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,9 @@ RailtypeInfo _railtypes[] = {
|
||||||
|
|
||||||
/* curve speed advantage (multiplier) */
|
/* curve speed advantage (multiplier) */
|
||||||
0,
|
0,
|
||||||
|
|
||||||
|
/* flags */
|
||||||
|
RTFB_NONE,
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Electrified railway */
|
/** Electrified railway */
|
||||||
|
@ -116,6 +119,9 @@ RailtypeInfo _railtypes[] = {
|
||||||
|
|
||||||
/* curve speed advantage (multiplier) */
|
/* curve speed advantage (multiplier) */
|
||||||
0,
|
0,
|
||||||
|
|
||||||
|
/* flags */
|
||||||
|
RTFB_CATENARY,
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Monorail */
|
/** Monorail */
|
||||||
|
@ -168,6 +174,9 @@ RailtypeInfo _railtypes[] = {
|
||||||
|
|
||||||
/* curve speed advantage (multiplier) */
|
/* curve speed advantage (multiplier) */
|
||||||
1,
|
1,
|
||||||
|
|
||||||
|
/* flags */
|
||||||
|
RTFB_NONE,
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Maglev */
|
/** Maglev */
|
||||||
|
@ -220,6 +229,9 @@ RailtypeInfo _railtypes[] = {
|
||||||
|
|
||||||
/* curve speed advantage (multiplier) */
|
/* curve speed advantage (multiplier) */
|
||||||
2,
|
2,
|
||||||
|
|
||||||
|
/* flags */
|
||||||
|
RTFB_NONE,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue