diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2019-04-22 08:11:28 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-04-29 17:40:22 +0100 |
commit | 96097b34a57feb7547c789b352e9b650fb2a9fea (patch) | |
tree | ba2a5b1917994b3956dfd626874fb6f61c5bceb0 /src | |
parent | 9f3928658bb3f8aaf21b17e0144cb09722474fff (diff) | |
download | openttd-96097b34a57feb7547c789b352e9b650fb2a9fea.tar.xz |
Codechange: Remove Direction*Byte types
Diffstat (limited to 'src')
-rw-r--r-- | src/aircraft.h | 2 | ||||
-rw-r--r-- | src/airport.h | 8 | ||||
-rw-r--r-- | src/direction_type.h | 6 | ||||
-rw-r--r-- | src/ship.h | 10 | ||||
-rw-r--r-- | src/station_base.h | 2 | ||||
-rw-r--r-- | src/table/airport_movement.h | 2 | ||||
-rw-r--r-- | src/vehicle_base.h | 2 |
7 files changed, 15 insertions, 17 deletions
diff --git a/src/aircraft.h b/src/aircraft.h index f4fce09be..3abb86b4f 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -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 diff --git a/src/airport.h b/src/airport.h index 31c68ef00..9e9eee870 100644 --- a/src/airport.h +++ b/src/airport.h @@ -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); diff --git a/src/direction_type.h b/src/direction_type.h index e6e08a182..cf6b9f5cf 100644 --- a/src/direction_type.h +++ b/src/direction_type.h @@ -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 /** diff --git a/src/ship.h b/src/ship.h index 807e69c5e..fff0aee5c 100644 --- a/src/ship.h +++ b/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() {} diff --git a/src/station_base.h b/src/station_base.h index b211e2bd4..a0cb2c015 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -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. diff --git a/src/table/airport_movement.h b/src/table/airport_movement.h index d9030f652..df368de89 100644 --- a/src/table/airport_movement.h +++ b/src/table/airport_movement.h @@ -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[] = { diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 523f1c263..9ccb67113 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -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? /** |