diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index b528d6fedd..32310b9c35 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -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. diff --git a/src/engine_type.h b/src/engine_type.h index 82f10d9d87..1cc0452a5f 100644 --- a/src/engine_type.h +++ b/src/engine_type.h @@ -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. diff --git a/src/newgrf.h b/src/newgrf.h index e5140d4eeb..c36005b0f2 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -126,7 +126,7 @@ struct GRFFile : ZeroedMemoryAllocator { uint8 cargo_map[NUM_CARGO]; ///< Inverse cargo translation table (CargoID -> local ID) std::vector 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 diff --git a/src/rail_type.h b/src/rail_type.h index 2bd602a37e..7e465866cf 100644 --- a/src/rail_type.h +++ b/src/rail_type.h @@ -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 : MakeEnumPropsT {}; -typedef TinyEnumT RailTypeByte; /** * The different railtypes we support, but then a bitmask of them. diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index 1590cb655e..f7309a474e 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -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(type == 0x25 ? 1 : 0); break; } diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp index d4580fc322..f9495ac2d1 100644 --- a/src/script/api/script_rail.cpp +++ b/src/script/api/script_rail.cpp @@ -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); } diff --git a/src/table/engines.h b/src/table/engines.h index 3b29a8dc17..a5acd28439 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -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 diff --git a/src/train.h b/src/train.h index b50a9d87b5..0256f63521 100644 --- a/src/train.h +++ b/src/train.h @@ -95,7 +95,7 @@ struct Train FINAL : public GroundVehicle { 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. */