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:
26
src/train.h
26
src/train.h
@@ -92,16 +92,16 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
||||
/* Link between the two ends of a multiheaded engine */
|
||||
Train *other_multiheaded_part;
|
||||
|
||||
uint16 crash_anim_pos; ///< Crash animation counter.
|
||||
uint16_t crash_anim_pos; ///< Crash animation counter.
|
||||
|
||||
uint16 flags;
|
||||
uint16_t flags;
|
||||
TrackBits track;
|
||||
TrainForceProceeding force_proceed;
|
||||
RailType railtype;
|
||||
RailTypes compatible_railtypes;
|
||||
|
||||
/** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */
|
||||
uint16 wait_counter;
|
||||
uint16_t wait_counter;
|
||||
|
||||
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
||||
Train() : GroundVehicleBase() {}
|
||||
@@ -184,11 +184,11 @@ 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() && HasPowerOnRail(this->railtype, GetRailType(this->tile))) {
|
||||
uint16 power = GetVehicleProperty(this, PROP_TRAIN_POWER, RailVehInfo(this->engine_type)->power);
|
||||
uint16_t power = GetVehicleProperty(this, PROP_TRAIN_POWER, RailVehInfo(this->engine_type)->power);
|
||||
/* Halve power for multiheaded parts */
|
||||
if (this->IsMultiheaded()) power /= 2;
|
||||
return power;
|
||||
@@ -201,7 +201,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Returns a value if this articulated part is powered.
|
||||
* @return Power value from the articulated part in HP, or zero if it is not powered.
|
||||
*/
|
||||
inline uint16 GetPoweredPartPower(const Train *head) const
|
||||
inline uint16_t GetPoweredPartPower(const Train *head) const
|
||||
{
|
||||
/* For powered wagons the engine defines the type of engine (i.e. railtype) */
|
||||
if (HasBit(this->flags, VRF_POWEREDWAGON) && HasPowerOnRail(head->railtype, GetRailType(this->tile))) {
|
||||
@@ -215,9 +215,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)->WeightOfNUnitsInTrain(this->cargo.StoredCount());
|
||||
uint16_t weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnitsInTrain(this->cargo.StoredCount());
|
||||
|
||||
/* Vehicle weight is not added for articulated parts. */
|
||||
if (!this->IsArticulatedPart()) {
|
||||
@@ -236,7 +236,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.
|
||||
@@ -279,7 +279,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;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ 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
|
||||
{
|
||||
/* Rolling friction for steel on steel is between 0.1% and 0.2%.
|
||||
* The friction coefficient increases with speed in a way that
|
||||
@@ -309,7 +309,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.train_slope_steepness;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ protected: // These functions should not be called outside acceleration code.
|
||||
* Gets the maximum speed allowed by the track for this vehicle.
|
||||
* @return Maximum speed allowed.
|
||||
*/
|
||||
inline uint16 GetMaxTrackSpeed() const
|
||||
inline uint16_t GetMaxTrackSpeed() const
|
||||
{
|
||||
return GetRailTypeInfo(GetRailType(this->tile))->max_speed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user