mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Remove Track{dir,}{Bits,}Byte types
This commit is contained in:
parent
931d32f414
commit
9f3928658b
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue