Adding of _t to (u)int types, and WChar to char32_t

See: eaae0bb5e
This commit is contained in:
Jonathan G Rennison
2024-01-07 16:41:53 +00:00
parent 55d78a23be
commit 97e6f3062e
655 changed files with 7555 additions and 7555 deletions

View File

@@ -33,12 +33,12 @@
* @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 mask)
uint32_t GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8, uint32_t mask)
{
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);
uint32 result = (is_same_industry ? 1 : 0) << 8;
uint32_t result = (is_same_industry ? 1 : 0) << 8;
if (mask & ~0x100) result |= GetNearbyTileInformation(tile, grf_version8, mask);
return result;
}
@@ -54,7 +54,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);
@@ -62,7 +62,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
return ((y & 0xF) << 20) | ((x & 0xF) << 16) | (y << 8) | x;
}
/* virtual */ uint32 IndustryTileScopeResolver::GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const
/* virtual */ uint32_t IndustryTileScopeResolver::GetVariable(uint16_t variable, uint32_t parameter, GetVariableExtra *extra) const
{
switch (variable) {
/* Construction state of the tile: a value between 0 and 3 */
@@ -103,7 +103,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
return UINT_MAX;
}
/* virtual */ uint32 IndustryTileScopeResolver::GetRandomBits() const
/* virtual */ uint32_t IndustryTileScopeResolver::GetRandomBits() const
{
assert_tile(this->industry != nullptr && IsValidTile(this->tile), this->tile);
assert_tile(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY), this->tile);
@@ -111,7 +111,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_tile(this->industry != nullptr && IsValidTile(this->tile), this->tile);
assert_tile(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY), this->tile);
@@ -140,7 +140,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),
@@ -154,7 +154,7 @@ GrfSpecFeature IndustryTileResolverObject::GetFeature() const
return GSF_INDUSTRYTILES;
}
uint32 IndustryTileResolverObject::GetDebugID() const
uint32_t IndustryTileResolverObject::GetDebugID() const
{
return GetIndustryTileSpec(gfx)->grf_prop.local_id;
}
@@ -182,7 +182,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_tile(industry != nullptr && IsValidTile(tile), tile);
assert_tile(industry->index == INVALID_INDUSTRY || IsTileType(tile, MP_INDUSTRY), tile);
@@ -197,7 +197,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);
}
@@ -231,7 +231,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;
@@ -241,7 +241,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);
@@ -255,7 +255,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);
}
@@ -277,7 +277,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));
@@ -290,7 +290,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)) {
@@ -304,7 +304,7 @@ bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigge
return ret;
}
uint8 GetNewIndustryTileAnimationSpeed(TileIndex tile)
uint8_t GetNewIndustryTileAnimationSpeed(TileIndex tile)
{
const IndustryTileSpec *itspec = GetIndustryTileSpec(GetIndustryGfx(tile));
if (itspec == nullptr) return 0;
@@ -319,7 +319,7 @@ uint8 GetNewIndustryTileAnimationSpeed(TileIndex tile)
* @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_tile(IsValidTile(tile) && IsTileType(tile, MP_INDUSTRY), tile);
@@ -354,11 +354,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;
}
@@ -370,7 +370,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);
@@ -383,7 +383,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);
@@ -414,12 +414,12 @@ void AnalyseIndustryTileSpriteGroups()
/* Layout now contains the translated tile layout with gaps removed, up to a maximum of 64 tiles */
uint64 anim_mask = 0;
uint64_t anim_mask = 0;
uint64 to_check = UINT64_MAX >> (64 - layout.size());
uint64_t to_check = UINT64_MAX >> (64 - layout.size());
while (to_check != 0) {
uint64 current = 0;
uint64_t current = 0;
uint i = FindFirstBit(to_check);
IndustryGfx gfx = layout[i].gfx;
for (; i < layout.size(); i++) {
@@ -463,7 +463,7 @@ void ApplyIndustryTileAnimMasking()
if (ind->selected_layout == 0 || ind->selected_layout > spec->layouts.size()) continue;
uint64 mask = spec->layout_anim_masks[ind->selected_layout - 1];
uint64_t mask = spec->layout_anim_masks[ind->selected_layout - 1];
uint idx = 0;
for (IndustryTileLayoutTile it : spec->layouts[ind->selected_layout - 1]) {