mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Remove RailTypeByte type
This commit is contained in:
parent
10ba431d21
commit
931d32f414
|
@ -1014,8 +1014,8 @@ void DisplayVehicleSortDropDown(Window *w, VehicleType vehicle_type, int selecte
|
|||
struct BuildVehicleWindow : Window {
|
||||
VehicleType vehicle_type; ///< Type of vehicles shown in the window.
|
||||
union {
|
||||
RailTypeByte railtype; ///< Rail type to show, or #RAILTYPE_END.
|
||||
RoadTypes roadtypes; ///< Road type to show, or #ROADTYPES_ALL.
|
||||
RailType railtype; ///< Rail type to show, or #RAILTYPE_END.
|
||||
RoadTypes roadtypes; ///< Road type to show, or #ROADTYPES_ALL.
|
||||
} filter; ///< Filter to apply.
|
||||
bool descending_sort_order; ///< Sort direction, @see _engine_sort_direction
|
||||
byte sort_criteria; ///< Current sort criterium.
|
||||
|
|
|
@ -44,7 +44,7 @@ struct RailVehicleInfo {
|
|||
byte image_index;
|
||||
RailVehicleTypes railveh_type;
|
||||
byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices.
|
||||
RailTypeByte railtype;
|
||||
RailType railtype;
|
||||
uint16 max_speed; ///< Maximum speed (1 unit = 1/1.6 mph = 1 km-ish/h)
|
||||
uint16 power; ///< Power of engine (hp); For multiheaded engines the sum of both engine powers.
|
||||
uint16 weight; ///< Weight of vehicle (tons); For multiheaded engines the weight of each single engine.
|
||||
|
|
|
@ -126,7 +126,7 @@ struct GRFFile : ZeroedMemoryAllocator {
|
|||
uint8 cargo_map[NUM_CARGO]; ///< Inverse cargo translation table (CargoID -> local ID)
|
||||
|
||||
std::vector<RailTypeLabel> railtype_list; ///< Railtype translation table
|
||||
RailTypeByte railtype_map[RAILTYPE_END];
|
||||
RailType railtype_map[RAILTYPE_END];
|
||||
|
||||
CanalProperties canal_local_properties[CF_END]; ///< Canal properties as set by this NewGRF
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ static const RailTypeLabel RAILTYPE_MAGLEV_LABEL = 'MGLV';
|
|||
*
|
||||
* This enumeration defines all 4 possible railtypes.
|
||||
*/
|
||||
enum RailType {
|
||||
enum RailType : byte {
|
||||
RAILTYPE_BEGIN = 0, ///< Used for iterations
|
||||
RAILTYPE_RAIL = 0, ///< Standard non-electric rails
|
||||
RAILTYPE_ELECTRIC = 1, ///< Electric rails
|
||||
|
@ -44,7 +44,6 @@ enum RailType {
|
|||
DECLARE_POSTFIX_INCREMENT(RailType)
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE, 6> {};
|
||||
typedef TinyEnumT<RailType> RailTypeByte;
|
||||
|
||||
/**
|
||||
* The different railtypes we support, but then a bitmask of them.
|
||||
|
|
|
@ -1277,7 +1277,8 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
|
|||
};
|
||||
if (v->spritenum / 2 >= lengthof(spriteset_rail)) return false;
|
||||
v->spritenum = spriteset_rail[v->spritenum / 2]; // adjust railway sprite set offset
|
||||
Train::From(v)->railtype = type == 0x25 ? 1 : 0; // monorail / rail
|
||||
/* Should be the original values for monorail / rail, can't use RailType constants */
|
||||
Train::From(v)->railtype = static_cast<RailType>(type == 0x25 ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
/* static */ bool ScriptRail::IsRailTypeAvailable(RailType rail_type)
|
||||
{
|
||||
if ((::RailType)rail_type < RAILTYPE_BEGIN || (::RailType)rail_type >= RAILTYPE_END) return false;
|
||||
if ((::RailType)rail_type >= RAILTYPE_END) return false;
|
||||
|
||||
return ScriptObject::GetCompany() == OWNER_DEITY || ::HasRailtypeAvail(ScriptObject::GetCompany(), (::RailType)rail_type);
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ static const EngineInfo _orig_engine_info[] = {
|
|||
* Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
|
||||
* Air drag value depends on the top speed of the vehicle.
|
||||
*/
|
||||
#define RVI(a, b, c, d, e, f, g, h, i, j, k) { a, b, c, {j}, d, e, f, g, h, k, i, 0, 0, 0, VE_DEFAULT, 0, 76, 0, 0 }
|
||||
#define RVI(a, b, c, d, e, f, g, h, i, j, k) { a, b, c, j, d, e, f, g, h, k, i, 0, 0, 0, VE_DEFAULT, 0, 76, 0, 0 }
|
||||
#define M RAILVEH_MULTIHEAD
|
||||
#define W RAILVEH_WAGON
|
||||
#define G RAILVEH_SINGLEHEAD
|
||||
|
|
|
@ -95,7 +95,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
|||
uint16 flags;
|
||||
TrackBitsByte track;
|
||||
TrainForceProceeding force_proceed;
|
||||
RailTypeByte railtype;
|
||||
RailType railtype;
|
||||
RailTypes compatible_railtypes;
|
||||
|
||||
/** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */
|
||||
|
|
Loading…
Reference in New Issue