summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/build_vehicle_gui.cpp4
-rw-r--r--src/engine_type.h2
-rw-r--r--src/newgrf.h2
-rw-r--r--src/rail_type.h3
-rw-r--r--src/saveload/oldloader_sl.cpp3
-rw-r--r--src/script/api/script_rail.cpp2
-rw-r--r--src/table/engines.h2
-rw-r--r--src/train.h2
8 files changed, 10 insertions, 10 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index b528d6fed..32310b9c3 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 82f10d9d8..1cc0452a5 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 e5140d4ee..c36005b0f 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<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
diff --git a/src/rail_type.h b/src/rail_type.h
index 2bd602a37..7e465866c 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<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.
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 1590cb655..f7309a474 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<RailType>(type == 0x25 ? 1 : 0);
break;
}
diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp
index d4580fc32..f9495ac2d 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 3b29a8dc1..a5acd2843 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 b50a9d87b..0256f6352 100644
--- a/src/train.h
+++ b/src/train.h
@@ -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. */