Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -107,10 +107,10 @@ struct RoadVehicle FINAL : public GroundVehicle<RoadVehicle, VEH_ROAD> {
|
||||
RoadVehPathCache path; ///< Cached path.
|
||||
byte state; ///< @see RoadVehicleStates
|
||||
byte frame;
|
||||
uint16 blocked_ctr;
|
||||
uint16_t blocked_ctr;
|
||||
byte overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0.
|
||||
byte overtaking_ctr; ///< The length of the current overtake attempt.
|
||||
uint16 crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed
|
||||
uint16_t crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed
|
||||
byte reverse_ctr;
|
||||
|
||||
RoadType roadtype; //!< Roadtype of this vehicle.
|
||||
@@ -152,7 +152,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Allows to know the power value that this vehicle will use.
|
||||
* @return Power value from the engine in HP, or zero if the vehicle is not powered.
|
||||
*/
|
||||
inline uint16 GetPower() const
|
||||
inline uint16_t GetPower() const
|
||||
{
|
||||
/* Power is not added for articulated parts */
|
||||
if (!this->IsArticulatedPart()) {
|
||||
@@ -166,7 +166,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Returns a value if this articulated part is powered.
|
||||
* @return Zero, because road vehicles don't have powered parts.
|
||||
*/
|
||||
inline uint16 GetPoweredPartPower(const RoadVehicle *head) const
|
||||
inline uint16_t GetPoweredPartPower(const RoadVehicle *head) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -175,9 +175,9 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Allows to know the weight value that this vehicle will use.
|
||||
* @return Weight value from the engine in tonnes.
|
||||
*/
|
||||
inline uint16 GetWeight() const
|
||||
inline uint16_t GetWeight() const
|
||||
{
|
||||
uint16 weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->cargo.StoredCount());
|
||||
uint16_t weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->cargo.StoredCount());
|
||||
|
||||
/* Vehicle weight is not added for articulated parts. */
|
||||
if (!this->IsArticulatedPart()) {
|
||||
@@ -192,7 +192,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Calculates the weight value that this vehicle will have when fully loaded with its current cargo.
|
||||
* @return Weight value in tonnes.
|
||||
*/
|
||||
uint16 GetMaxWeight() const override;
|
||||
uint16_t GetMaxWeight() const override;
|
||||
|
||||
/**
|
||||
* Allows to know the tractive effort value that this vehicle will use.
|
||||
@@ -235,7 +235,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Calculates the current speed of this vehicle.
|
||||
* @return Current speed in km/h-ish.
|
||||
*/
|
||||
inline uint16 GetCurrentSpeed() const
|
||||
inline uint16_t GetCurrentSpeed() const
|
||||
{
|
||||
return this->cur_speed / 2;
|
||||
}
|
||||
@@ -244,11 +244,11 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Returns the rolling friction coefficient of this vehicle.
|
||||
* @return Rolling friction coefficient in [1e-4].
|
||||
*/
|
||||
inline uint32 GetRollingFriction() const
|
||||
inline uint32_t GetRollingFriction() const
|
||||
{
|
||||
/* Trams have a slightly greater friction coefficient than trains.
|
||||
* The rest of road vehicles have bigger values. */
|
||||
uint32 coeff = RoadTypeIsTram(this->roadtype) ? 40 : 75;
|
||||
uint32_t coeff = RoadTypeIsTram(this->roadtype) ? 40 : 75;
|
||||
/* The friction coefficient increases with speed in a way that
|
||||
* it doubles at 128 km/h, triples at 256 km/h and so on. */
|
||||
return coeff * (128 + this->GetCurrentSpeed()) / 128;
|
||||
@@ -267,7 +267,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Returns the slope steepness used by this vehicle.
|
||||
* @return Slope steepness used by the vehicle.
|
||||
*/
|
||||
inline uint32 GetSlopeSteepness() const
|
||||
inline uint32_t GetSlopeSteepness() const
|
||||
{
|
||||
return _settings_game.vehicle.roadveh_slope_steepness;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Gets the maximum speed allowed by the track for this vehicle.
|
||||
* @return Since roads don't limit road vehicle speed, it returns always zero.
|
||||
*/
|
||||
inline uint16 GetMaxTrackSpeed() const
|
||||
inline uint16_t GetMaxTrackSpeed() const
|
||||
{
|
||||
return GetRoadTypeInfo(GetRoadType(this->tile, GetRoadTramType(this->roadtype)))->max_speed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user