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

@@ -31,7 +31,7 @@
* @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8.
* @return a construction of bits obeying the newgrf format
*/
uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8)
uint32_t GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8)
{
if (parameter != 0) tile = GetNearbyTile(parameter, tile, signed_offsets); // only perform if it is required
bool is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index);
@@ -50,7 +50,7 @@ uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, Industry
* @param tile TileIndex of the tile to evaluate
* @param ind_tile northernmost tile of the industry
*/
uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
uint32_t GetRelativePosition(TileIndex tile, TileIndex ind_tile)
{
byte x = TileX(tile) - TileX(ind_tile);
byte y = TileY(tile) - TileY(ind_tile);
@@ -58,7 +58,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
return ((y & 0xF) << 20) | ((x & 0xF) << 16) | (y << 8) | x;
}
/* virtual */ uint32 IndustryTileScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
/* virtual */ uint32_t IndustryTileScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const
{
switch (variable) {
/* Construction state of the tile: a value between 0 and 3 */
@@ -99,7 +99,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
return UINT_MAX;
}
/* virtual */ uint32 IndustryTileScopeResolver::GetRandomBits() const
/* virtual */ uint32_t IndustryTileScopeResolver::GetRandomBits() const
{
assert(this->industry != nullptr && IsValidTile(this->tile));
assert(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY));
@@ -107,7 +107,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
return (this->industry->index != INVALID_INDUSTRY) ? GetIndustryRandomBits(this->tile) : 0;
}
/* virtual */ uint32 IndustryTileScopeResolver::GetTriggers() const
/* virtual */ uint32_t IndustryTileScopeResolver::GetTriggers() const
{
assert(this->industry != nullptr && IsValidTile(this->tile));
assert(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY));
@@ -136,7 +136,7 @@ static const GRFFile *GetIndTileGrffile(IndustryGfx gfx)
* @param callback_param2 Second parameter (var 18) of the callback.
*/
IndustryTileResolverObject::IndustryTileResolverObject(IndustryGfx gfx, TileIndex tile, Industry *indus,
CallbackID callback, uint32 callback_param1, uint32 callback_param2)
CallbackID callback, uint32_t callback_param1, uint32_t callback_param2)
: ResolverObject(GetIndTileGrffile(gfx), callback, callback_param1, callback_param2),
indtile_scope(*this, indus, tile),
ind_scope(*this, tile, indus, indus->type),
@@ -150,7 +150,7 @@ GrfSpecFeature IndustryTileResolverObject::GetFeature() const
return GSF_INDUSTRYTILES;
}
uint32 IndustryTileResolverObject::GetDebugID() const
uint32_t IndustryTileResolverObject::GetDebugID() const
{
return GetIndustryTileSpec(gfx)->grf_prop.local_id;
}
@@ -178,7 +178,7 @@ static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGro
DrawNewGRFTileSeq(ti, dts, TO_INDUSTRIES, stage, GENERAL_SPRITE_COLOUR(rnd_colour));
}
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
uint16_t GetIndustryTileCallback(CallbackID callback, uint32_t param1, uint32_t param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
{
assert(industry != nullptr && IsValidTile(tile));
assert(industry->index == INVALID_INDUSTRY || IsTileType(tile, MP_INDUSTRY));
@@ -193,7 +193,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
bool draw_old_one = true;
if (HasBit(inds->callback_mask, CBM_INDT_DRAW_FOUNDATIONS)) {
/* Called to determine the type (if any) of foundation to draw for industry tile */
uint32 callback_res = GetIndustryTileCallback(CBID_INDTILE_DRAW_FOUNDATIONS, 0, 0, gfx, i, ti->tile);
uint32_t callback_res = GetIndustryTileCallback(CBID_INDTILE_DRAW_FOUNDATIONS, 0, 0, gfx, i, ti->tile);
if (callback_res != CALLBACK_FAILED) draw_old_one = ConvertBooleanCallback(inds->grf_prop.grffile, CBID_INDTILE_DRAW_FOUNDATIONS, callback_res);
}
@@ -227,7 +227,7 @@ extern bool IsSlopeRefused(Slope current, Slope refused);
* @param creation_type The circumstances the industry is created under.
* @return Succeeded or failed command.
*/
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, size_t layout_index, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, size_t layout_index, uint16_t initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
{
Industry ind;
ind.index = INVALID_INDUSTRY;
@@ -237,7 +237,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
ind.random = initial_random_bits;
ind.founder = founder;
uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | (uint32)layout_index, gfx, &ind, ind_tile);
uint16_t callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | (uint32_t)layout_index, gfx, &ind, ind_tile);
if (callback_res == CALLBACK_FAILED) {
if (!IsSlopeRefused(GetTileSlope(ind_tile), its->slopes_refused)) return CommandCost();
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
@@ -251,7 +251,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
}
/* Simple wrapper for GetHouseCallback to keep the animation unified. */
uint16 GetSimpleIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, const IndustryTileSpec *spec, Industry *ind, TileIndex tile, int extra_data)
uint16_t GetSimpleIndustryCallback(CallbackID callback, uint32_t param1, uint32_t param2, const IndustryTileSpec *spec, Industry *ind, TileIndex tile, int extra_data)
{
return GetIndustryTileCallback(callback, param1, param2, spec - GetIndustryTileSpec(0), ind, tile);
}
@@ -273,7 +273,7 @@ void AnimateNewIndustryTile(TileIndex tile)
IndustryAnimationBase::AnimateTile(itspec, Industry::GetByTile(tile), tile, (itspec->special_flags & INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS) != 0);
}
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32 random)
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32_t random)
{
const IndustryTileSpec *itspec = GetIndustryTileSpec(GetIndustryGfx(tile));
@@ -286,7 +286,7 @@ bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat
bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat)
{
bool ret = true;
uint32 random = Random();
uint32_t random = Random();
for (TileIndex tile : ind->location) {
if (ind->TileBelongsToIndustry(tile)) {
if (StartStopIndustryTileAnimation(tile, iat, random)) {
@@ -307,7 +307,7 @@ bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigge
* @param ind Industry of the tile.
* @param[in,out] reseed_industry Collects bits to reseed for the industry.
*/
static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, Industry *ind, uint32 &reseed_industry)
static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, Industry *ind, uint32_t &reseed_industry)
{
assert(IsValidTile(tile) && IsTileType(tile, MP_INDUSTRY));
@@ -342,11 +342,11 @@ static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, I
* @param ind Industry.
* @param reseed Bits to reseed.
*/
static void DoReseedIndustry(Industry *ind, uint32 reseed)
static void DoReseedIndustry(Industry *ind, uint32_t reseed)
{
if (reseed == 0 || ind == nullptr) return;
uint16 random_bits = Random();
uint16_t random_bits = Random();
ind->random &= reseed;
ind->random |= random_bits & reseed;
}
@@ -358,7 +358,7 @@ static void DoReseedIndustry(Industry *ind, uint32 reseed)
*/
void TriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger)
{
uint32 reseed_industry = 0;
uint32_t reseed_industry = 0;
Industry *ind = Industry::GetByTile(tile);
DoTriggerIndustryTile(tile, trigger, ind, reseed_industry);
DoReseedIndustry(ind, reseed_industry);
@@ -371,7 +371,7 @@ void TriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger)
*/
void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger)
{
uint32 reseed_industry = 0;
uint32_t reseed_industry = 0;
for (TileIndex tile : ind->location) {
if (ind->TileBelongsToIndustry(tile)) {
DoTriggerIndustryTile(tile, trigger, ind, reseed_industry);