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:
Rubidium
2023-05-08 19:01:06 +02:00
committed by rubidium42
parent 4f4810dc28
commit eaae0bb5e7
564 changed files with 4561 additions and 4561 deletions

View File

@@ -18,7 +18,7 @@
#include "sound_type.h"
#include "strings_type.h"
typedef uint16 EngineID; ///< Unique identification number of an engine.
typedef uint16_t EngineID; ///< Unique identification number of an engine.
struct Engine;
@@ -45,30 +45,30 @@ struct RailVehicleInfo {
byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices.
RailType railtype; ///< Railtype, mangled if elrail is disabled.
RailType intended_railtype; ///< Intended railtype, regardless of elrail being enabled or disabled.
uint16 max_speed; ///< Maximum speed (1 unit = 1/1.6 mph = 1 km-ish/h)
uint16 power; ///< Power of engine (hp); For multiheaded engines the sum of both engine powers.
uint16 weight; ///< Weight of vehicle (tons); For multiheaded engines the weight of each single engine.
uint16_t max_speed; ///< Maximum speed (1 unit = 1/1.6 mph = 1 km-ish/h)
uint16_t power; ///< Power of engine (hp); For multiheaded engines the sum of both engine powers.
uint16_t weight; ///< Weight of vehicle (tons); For multiheaded engines the weight of each single engine.
byte running_cost; ///< Running cost of engine; For multiheaded engines the sum of both running costs.
Price running_cost_class;
EngineClass engclass; ///< Class of engine for this vehicle
byte capacity; ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine.
byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only
uint16 pow_wag_power; ///< Extra power applied to consist if wagon should be powered
uint16_t pow_wag_power; ///< Extra power applied to consist if wagon should be powered
byte pow_wag_weight; ///< Extra weight applied to consist if wagon should be powered
byte visual_effect; ///< Bitstuffed NewGRF visual effect data
byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
byte tractive_effort; ///< Tractive effort coefficient
byte air_drag; ///< Coefficient of air drag
byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
int16 curve_speed_mod; ///< Modifier to maximum speed in curves (fixed-point binary with 8 fractional bits)
int16_t curve_speed_mod; ///< Modifier to maximum speed in curves (fixed-point binary with 8 fractional bits)
};
/** Information about a ship vehicle. */
struct ShipVehicleInfo {
byte image_index;
byte cost_factor;
uint16 max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
uint16 capacity;
uint16_t max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
uint16_t capacity;
byte running_cost;
SoundID sfx;
bool old_refittable; ///< Is ship refittable; only used during initialisation. Later use EngineInfo::refit_mask.
@@ -103,10 +103,10 @@ struct AircraftVehicleInfo {
byte subtype; ///< Type of aircraft. @see AircraftSubTypeBits
SoundID sfx;
byte acceleration;
uint16 max_speed; ///< Maximum speed (1 unit = 8 mph = 12.8 km-ish/h)
uint16_t max_speed; ///< Maximum speed (1 unit = 8 mph = 12.8 km-ish/h)
byte mail_capacity; ///< Mail capacity (bags).
uint16 passenger_capacity; ///< Passenger capacity (persons).
uint16 max_range; ///< Maximum range of this aircraft.
uint16_t passenger_capacity; ///< Passenger capacity (persons).
uint16_t max_range; ///< Maximum range of this aircraft.
};
/** Information about a road vehicle. */
@@ -116,18 +116,18 @@ struct RoadVehicleInfo {
byte running_cost;
Price running_cost_class;
SoundID sfx;
uint16 max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
uint16_t max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
byte capacity;
uint8 weight; ///< Weight in 1/4t units
uint8 power; ///< Power in 10hp units
uint8 tractive_effort; ///< Coefficient of tractive effort
uint8 air_drag; ///< Coefficient of air drag
uint8_t weight; ///< Weight in 1/4t units
uint8_t power; ///< Power in 10hp units
uint8_t tractive_effort; ///< Coefficient of tractive effort
uint8_t air_drag; ///< Coefficient of air drag
byte visual_effect; ///< Bitstuffed NewGRF visual effect data
byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
RoadType roadtype; ///< Road type
};
enum class ExtraEngineFlags : uint32 {
enum class ExtraEngineFlags : uint32_t {
None = 0,
NoNews = (1U << 0), ///< No 'new vehicle' news will be generated.
NoPreview = (1U << 1), ///< No exclusive preview will be offered.
@@ -151,10 +151,10 @@ struct EngineInfo {
CargoTypes refit_mask;
byte refit_cost;
byte misc_flags; ///< Miscellaneous flags. @see EngineMiscFlags
uint16 callback_mask; ///< Bitmask of vehicle callbacks that have to be called
int8 retire_early; ///< Number of years early to retire vehicle
uint16_t callback_mask; ///< Bitmask of vehicle callbacks that have to be called
int8_t retire_early; ///< Number of years early to retire vehicle
StringID string_id; ///< Default name of engine
uint16 cargo_age_period; ///< Number of ticks before carried cargo is aged.
uint16_t cargo_age_period; ///< Number of ticks before carried cargo is aged.
EngineID variant_id; ///< Engine variant ID. If set, will be treated specially in purchase lists.
ExtraEngineFlags extra_flags;
};
@@ -185,7 +185,7 @@ enum EngineFlags {
/**
* Contexts an engine name can be shown in.
*/
enum EngineNameContext : uint8 {
enum EngineNameContext : uint8_t {
Generic = 0x00, ///< No specific context available.
VehicleDetails = 0x11, ///< Name is shown in the vehicle details GUI.
PurchaseList = 0x20, ///< Name is shown in the purchase list (including autoreplace window 'Available vehicles' panel).
@@ -194,9 +194,9 @@ enum EngineNameContext : uint8 {
};
/** Combine an engine ID and a name context to an engine name dparam. */
inline uint64 PackEngineNameDParam(EngineID engine_id, EngineNameContext context, uint32 extra_data = 0)
inline uint64_t PackEngineNameDParam(EngineID engine_id, EngineNameContext context, uint32_t extra_data = 0)
{
return engine_id | (static_cast<uint64>(context) << 32) | (static_cast<uint64>(extra_data) << 40);
return engine_id | (static_cast<uint64_t>(context) << 32) | (static_cast<uint64_t>(extra_data) << 40);
}
static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32; ///< The maximum length of an engine name in characters including '\0'