summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pathfinder/yapf/yapf_road.cpp4
-rw-r--r--src/pathfinder/yapf/yapf_ship.cpp4
-rw-r--r--src/roadveh.h2
-rw-r--r--src/ship.h4
-rw-r--r--src/track_type.h12
-rw-r--r--src/train.h2
6 files changed, 10 insertions, 18 deletions
diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp
index 3122dd111..9e206115f 100644
--- a/src/pathfinder/yapf/yapf_road.cpp
+++ b/src/pathfinder/yapf/yapf_road.cpp
@@ -390,9 +390,7 @@ public:
while (pNode->m_parent != nullptr) {
steps--;
if (pNode->GetIsChoice() && steps < YAPF_ROADVEH_PATH_CACHE_SEGMENTS) {
- TrackdirByte td;
- td = pNode->GetTrackdir();
- path_cache.td.push_front(td);
+ path_cache.td.push_front(pNode->GetTrackdir());
path_cache.tile.push_front(pNode->GetTile());
}
pNode = pNode->m_parent;
diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp
index e7391d686..09a4fc76a 100644
--- a/src/pathfinder/yapf/yapf_ship.cpp
+++ b/src/pathfinder/yapf/yapf_ship.cpp
@@ -98,9 +98,7 @@ public:
while (pNode->m_parent != nullptr) {
steps--;
if (steps > 0 && steps < YAPF_SHIP_PATH_CACHE_LENGTH) {
- TrackdirByte td;
- td = pNode->GetTrackdir();
- path_cache.push_front(td);
+ path_cache.push_front(pNode->GetTrackdir());
}
pPrevNode = pNode;
pNode = pNode->m_parent;
diff --git a/src/roadveh.h b/src/roadveh.h
index 22f827b1d..7c8f32d0f 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -84,7 +84,7 @@ void RoadVehUpdateCache(RoadVehicle *v, bool same_length = false);
void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type);
struct RoadVehPathCache {
- std::deque<TrackdirByte> td;
+ std::deque<Trackdir> td;
std::deque<TileIndex> tile;
inline bool empty() const { return this->td.empty(); }
diff --git a/src/ship.h b/src/ship.h
index 6f818efb2..807e69c5e 100644
--- a/src/ship.h
+++ b/src/ship.h
@@ -20,13 +20,13 @@
void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type);
WaterClass GetEffectiveWaterClass(TileIndex tile);
-typedef std::deque<TrackdirByte> ShipPathCache;
+typedef std::deque<Trackdir> ShipPathCache;
/**
* All ships have this type.
*/
struct Ship FINAL : public SpecializedVehicle<Ship, VEH_SHIP> {
- TrackBitsByte state; ///< The "track" the ship is following.
+ TrackBits state; ///< The "track" the ship is following.
ShipPathCache path; ///< Cached path.
DirectionByte rotation; ///< Visible direction.
int16 rotation_x_pos; ///< NOSAVE: X Position before rotation.
diff --git a/src/track_type.h b/src/track_type.h
index 2982288bb..233376b00 100644
--- a/src/track_type.h
+++ b/src/track_type.h
@@ -18,7 +18,7 @@
* These are used to specify a single track.
* Can be translated to a trackbit with TrackToTrackbit
*/
-enum Track {
+enum Track : byte {
TRACK_BEGIN = 0, ///< Used for iterations
TRACK_X = 0, ///< Track along the x-axis (north-east to south-west)
TRACK_Y = 1, ///< Track along the y-axis (north-west to south-east)
@@ -34,11 +34,10 @@ enum Track {
DECLARE_POSTFIX_INCREMENT(Track)
/** Define basic enum properties */
template <> struct EnumPropsT<Track> : MakeEnumPropsT<Track, byte, TRACK_BEGIN, TRACK_END, INVALID_TRACK, 3> {};
-typedef TinyEnumT<Track> TrackByte;
/** Bitfield corresponding to Track */
-enum TrackBits {
+enum TrackBits : byte {
TRACK_BIT_NONE = 0U, ///< No track
TRACK_BIT_X = 1U << TRACK_X, ///< X-axis track
TRACK_BIT_Y = 1U << TRACK_Y, ///< Y-axis track
@@ -60,7 +59,6 @@ enum TrackBits {
INVALID_TRACK_BIT = 0xFF, ///< Flag for an invalid trackbits value
};
DECLARE_ENUM_AS_BIT_SET(TrackBits)
-typedef SimpleTinyEnumT<TrackBits, byte> TrackBitsByte;
/**
* Enumeration for tracks and directions.
@@ -71,7 +69,7 @@ typedef SimpleTinyEnumT<TrackBits, byte> TrackBitsByte;
* reversing track dirs are not considered to be 'valid' except in a small
* corner in the road vehicle controller.
*/
-enum Trackdir {
+enum Trackdir : byte {
TRACKDIR_BEGIN = 0, ///< Used for iterations
TRACKDIR_X_NE = 0, ///< X-axis and direction to north-east
TRACKDIR_Y_SE = 1, ///< Y-axis and direction to south-east
@@ -95,7 +93,6 @@ enum Trackdir {
/** Define basic enum properties */
template <> struct EnumPropsT<Trackdir> : MakeEnumPropsT<Trackdir, byte, TRACKDIR_BEGIN, TRACKDIR_END, INVALID_TRACKDIR, 4> {};
-typedef TinyEnumT<Trackdir> TrackdirByte;
/**
* Enumeration of bitmasks for the TrackDirs
@@ -103,7 +100,7 @@ typedef TinyEnumT<Trackdir> TrackdirByte;
* These are a combination of tracks and directions. Values are 0-5 in one
* direction (corresponding to the Track enum) and 8-13 in the other direction.
*/
-enum TrackdirBits {
+enum TrackdirBits : uint16 {
TRACKDIR_BIT_NONE = 0U, ///< No track build
TRACKDIR_BIT_X_NE = 1U << TRACKDIR_X_NE, ///< Track x-axis, direction north-east
TRACKDIR_BIT_Y_SE = 1U << TRACKDIR_Y_SE, ///< Track y-axis, direction south-east
@@ -122,7 +119,6 @@ enum TrackdirBits {
INVALID_TRACKDIR_BIT = 0xFFFF, ///< Flag for an invalid trackdirbit value
};
DECLARE_ENUM_AS_BIT_SET(TrackdirBits)
-typedef SimpleTinyEnumT<TrackdirBits, uint16> TrackdirBitsShort;
typedef uint32 TrackStatus;
diff --git a/src/train.h b/src/train.h
index 0256f6352..e122fcf2f 100644
--- a/src/train.h
+++ b/src/train.h
@@ -93,7 +93,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
uint16 crash_anim_pos; ///< Crash animation counter.
uint16 flags;
- TrackBitsByte track;
+ TrackBits track;
TrainForceProceeding force_proceed;
RailType railtype;
RailTypes compatible_railtypes;