Changeset - r23670:17ce345f83e6
[Not reviewed]
master
0 6 0
Charles Pigott - 5 years ago 2019-04-22 07:03:04
charlespigott@googlemail.com
Codechange: Remove Track{dir,}{Bits,}Byte types
6 files changed with 10 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/pathfinder/yapf/yapf_road.cpp
Show inline comments
 
@@ -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;
src/pathfinder/yapf/yapf_ship.cpp
Show inline comments
 
@@ -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;
src/roadveh.h
Show inline comments
 
@@ -84,7 +84,7 @@ void RoadVehUpdateCache(RoadVehicle *v, 
 
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(); }
src/ship.h
Show inline comments
 
@@ -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.
src/track_type.h
Show inline comments
 
@@ -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>
 
 * 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;
 

	
src/train.h
Show inline comments
 
@@ -93,7 +93,7 @@ struct Train FINAL : public GroundVehicl
 
	uint16 crash_anim_pos; ///< Crash animation counter.
 

	
 
	uint16 flags;
 
	TrackBitsByte track;
 
	TrackBits track;
 
	TrainForceProceeding force_proceed;
 
	RailType railtype;
 
	RailTypes compatible_railtypes;
0 comments (0 inline, 0 general)