mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Remove Direction*Byte types
This commit is contained in:
parent
9f3928658b
commit
96097b34a5
|
@ -79,7 +79,7 @@ struct Aircraft FINAL : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
|
|||
byte previous_pos; ///< Previous desired position of the aircraft.
|
||||
StationID targetairport; ///< Airport to go to next.
|
||||
byte state; ///< State of the airport. @see AirportMovementStates
|
||||
DirectionByte last_direction;
|
||||
Direction last_direction;
|
||||
byte number_consecutive_turns; ///< Protection to prevent the aircraft of making a lot of turns in order to reach a specific point.
|
||||
byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns.
|
||||
byte flags; ///< Aircraft flags. @see AirVehicleFlags
|
||||
|
|
|
@ -130,10 +130,10 @@ static const uint64
|
|||
|
||||
/** A single location on an airport where aircraft can move to. */
|
||||
struct AirportMovingData {
|
||||
int16 x; ///< x-coordinate of the destination.
|
||||
int16 y; ///< y-coordinate of the destination.
|
||||
uint16 flag; ///< special flags when moving towards the destination.
|
||||
DirectionByte direction; ///< Direction to turn the aircraft after reaching the destination.
|
||||
int16 x; ///< x-coordinate of the destination.
|
||||
int16 y; ///< y-coordinate of the destination.
|
||||
uint16 flag; ///< special flags when moving towards the destination.
|
||||
Direction direction; ///< Direction to turn the aircraft after reaching the destination.
|
||||
};
|
||||
|
||||
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* your viewport and not rotated by 45 degrees left or right to get
|
||||
* a "north" used in you games.
|
||||
*/
|
||||
enum Direction {
|
||||
enum Direction : byte {
|
||||
DIR_BEGIN = 0, ///< Used to iterate
|
||||
DIR_N = 0, ///< North
|
||||
DIR_NE = 1, ///< Northeast
|
||||
|
@ -42,7 +42,6 @@ DECLARE_POSTFIX_INCREMENT(Direction)
|
|||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR, 3> {};
|
||||
typedef TinyEnumT<Direction> DirectionByte; ///< typedefing-enumification of Direction
|
||||
|
||||
|
||||
/**
|
||||
|
@ -77,7 +76,7 @@ enum DirDiff {
|
|||
*
|
||||
* This enumeration is used for the 4 direction of the tile-edges.
|
||||
*/
|
||||
enum DiagDirection {
|
||||
enum DiagDirection : byte {
|
||||
DIAGDIR_BEGIN = 0, ///< Used for iterations
|
||||
DIAGDIR_NE = 0, ///< Northeast, upper right on your monitor
|
||||
DIAGDIR_SE = 1, ///< Southeast
|
||||
|
@ -92,7 +91,6 @@ DECLARE_POSTFIX_INCREMENT(DiagDirection)
|
|||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR, 2> {};
|
||||
typedef TinyEnumT<DiagDirection> DiagDirectionByte; ///< typedefing-enumification of DiagDirection
|
||||
|
||||
|
||||
/**
|
||||
|
|
10
src/ship.h
10
src/ship.h
|
@ -26,11 +26,11 @@ typedef std::deque<Trackdir> ShipPathCache;
|
|||
* All ships have this type.
|
||||
*/
|
||||
struct Ship FINAL : public SpecializedVehicle<Ship, VEH_SHIP> {
|
||||
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.
|
||||
int16 rotation_y_pos; ///< NOSAVE: Y Position before rotation.
|
||||
TrackBits state; ///< The "track" the ship is following.
|
||||
ShipPathCache path; ///< Cached path.
|
||||
Direction rotation; ///< Visible direction.
|
||||
int16 rotation_x_pos; ///< NOSAVE: X Position before rotation.
|
||||
int16 rotation_y_pos; ///< NOSAVE: Y Position before rotation.
|
||||
|
||||
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
||||
Ship() : SpecializedVehicleBase() {}
|
||||
|
|
|
@ -310,7 +310,7 @@ struct Airport : public TileArea {
|
|||
uint64 flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32
|
||||
byte type; ///< Type of this airport, @see AirportTypes
|
||||
byte layout; ///< Airport layout number.
|
||||
DirectionByte rotation; ///< How this airport is rotated.
|
||||
Direction rotation; ///< How this airport is rotated.
|
||||
|
||||
PersistentStorage *psa; ///< Persistent storage for NewGRF airports.
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ struct AirportFTAbuildup {
|
|||
* @param flags Movement flags.
|
||||
* @param dir Direction.
|
||||
*/
|
||||
#define AMD(x, y, flags, dir) { x, y, flags, {dir} }
|
||||
#define AMD(x, y, flags, dir) { x, y, flags, dir }
|
||||
|
||||
/** Dummy airport. */
|
||||
static const AirportMovingData _airport_moving_data_dummy[] = {
|
||||
|
|
|
@ -268,7 +268,7 @@ public:
|
|||
int32 x_pos; ///< x coordinate.
|
||||
int32 y_pos; ///< y coordinate.
|
||||
int32 z_pos; ///< z coordinate.
|
||||
DirectionByte direction; ///< facing
|
||||
Direction direction; ///< facing
|
||||
|
||||
OwnerByte owner; ///< Which company owns the vehicle?
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue