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:
@@ -39,7 +39,7 @@
|
||||
* @param maximum of entities this manager can deal with. i.e: houses = 512
|
||||
* @param invalid is the ID used to identify an invalid entity id
|
||||
*/
|
||||
OverrideManagerBase::OverrideManagerBase(uint16 offset, uint16 maximum, uint16 invalid)
|
||||
OverrideManagerBase::OverrideManagerBase(uint16_t offset, uint16_t maximum, uint16_t invalid)
|
||||
{
|
||||
this->max_offset = offset;
|
||||
this->max_entities = maximum;
|
||||
@@ -59,7 +59,7 @@ OverrideManagerBase::OverrideManagerBase(uint16 offset, uint16 maximum, uint16 i
|
||||
* @param grfid ID of the grf file
|
||||
* @param entity_type original entity type
|
||||
*/
|
||||
void OverrideManagerBase::Add(uint16_t local_id, uint32 grfid, uint entity_type)
|
||||
void OverrideManagerBase::Add(uint16_t local_id, uint32_t grfid, uint entity_type)
|
||||
{
|
||||
assert(entity_type < this->max_offset);
|
||||
/* An override can be set only once */
|
||||
@@ -78,7 +78,7 @@ void OverrideManagerBase::ResetMapping()
|
||||
void OverrideManagerBase::ResetOverride()
|
||||
{
|
||||
std::fill(this->entity_overrides.begin(), this->entity_overrides.end(), this->invalid_id);
|
||||
std::fill(this->grfid_overrides.begin(), this->grfid_overrides.end(), uint32());
|
||||
std::fill(this->grfid_overrides.begin(), this->grfid_overrides.end(), uint32_t());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,9 +87,9 @@ void OverrideManagerBase::ResetOverride()
|
||||
* @param grfid ID of the grf file
|
||||
* @return the ID of the candidate, of the Invalid flag item ID
|
||||
*/
|
||||
uint16 OverrideManagerBase::GetID(uint16_t grf_local_id, uint32 grfid) const
|
||||
uint16_t OverrideManagerBase::GetID(uint16_t grf_local_id, uint32_t grfid) const
|
||||
{
|
||||
for (uint16 id = 0; id < this->max_entities; id++) {
|
||||
for (uint16_t id = 0; id < this->max_entities; id++) {
|
||||
const EntityIDMapping *map = &this->mappings[id];
|
||||
if (map->entity_id == grf_local_id && map->grfid == grfid) {
|
||||
return id;
|
||||
@@ -106,9 +106,9 @@ uint16 OverrideManagerBase::GetID(uint16_t grf_local_id, uint32 grfid) const
|
||||
* @param substitute_id is the original entity from which data is copied for the new one
|
||||
* @return the proper usable slot id, or invalid marker if none is found
|
||||
*/
|
||||
uint16 OverrideManagerBase::AddEntityID(uint16_t grf_local_id, uint32 grfid, uint16_t substitute_id)
|
||||
uint16_t OverrideManagerBase::AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id)
|
||||
{
|
||||
uint16 id = this->GetID(grf_local_id, grfid);
|
||||
uint16_t id = this->GetID(grf_local_id, grfid);
|
||||
|
||||
/* Look to see if this entity has already been added. This is done
|
||||
* separately from the loop below in case a GRF has been deleted, and there
|
||||
@@ -136,7 +136,7 @@ uint16 OverrideManagerBase::AddEntityID(uint16_t grf_local_id, uint32 grfid, uin
|
||||
* @param entity_id ID of the entity being queried.
|
||||
* @return GRFID.
|
||||
*/
|
||||
uint32 OverrideManagerBase::GetGRFID(uint16 entity_id) const
|
||||
uint32_t OverrideManagerBase::GetGRFID(uint16_t entity_id) const
|
||||
{
|
||||
return this->mappings[entity_id].grfid;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ uint32 OverrideManagerBase::GetGRFID(uint16 entity_id) const
|
||||
* @param entity_id of the entity being queried
|
||||
* @return mapped id
|
||||
*/
|
||||
uint16 OverrideManagerBase::GetSubstituteID(uint16 entity_id) const
|
||||
uint16_t OverrideManagerBase::GetSubstituteID(uint16_t entity_id) const
|
||||
{
|
||||
return this->mappings[entity_id].substitute_id;
|
||||
}
|
||||
@@ -185,9 +185,9 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs)
|
||||
* @param grfid ID of the grf file
|
||||
* @return the ID of the candidate, of the Invalid flag item ID
|
||||
*/
|
||||
uint16 IndustryOverrideManager::GetID(uint16_t grf_local_id, uint32 grfid) const
|
||||
uint16_t IndustryOverrideManager::GetID(uint16_t grf_local_id, uint32_t grfid) const
|
||||
{
|
||||
uint16 id = OverrideManagerBase::GetID(grf_local_id, grfid);
|
||||
uint16_t id = OverrideManagerBase::GetID(grf_local_id, grfid);
|
||||
if (id != this->invalid_id) return id;
|
||||
|
||||
/* No mapping found, try the overrides */
|
||||
@@ -205,10 +205,10 @@ uint16 IndustryOverrideManager::GetID(uint16_t grf_local_id, uint32 grfid) const
|
||||
* @param substitute_id industry from which data has been copied
|
||||
* @return a free entity id (slotid) if ever one has been found, or Invalid_ID marker otherwise
|
||||
*/
|
||||
uint16 IndustryOverrideManager::AddEntityID(uint16_t grf_local_id, uint32 grfid, uint16 substitute_id)
|
||||
uint16_t IndustryOverrideManager::AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id)
|
||||
{
|
||||
/* This entity hasn't been defined before, so give it an ID now. */
|
||||
for (uint16 id = 0; id < this->max_entities; id++) {
|
||||
for (uint16_t id = 0; id < this->max_entities; id++) {
|
||||
/* Skip overridden industries */
|
||||
if (id < this->max_offset && this->entity_overrides[id] != this->invalid_id) continue;
|
||||
|
||||
@@ -328,7 +328,7 @@ void ObjectOverrideManager::SetEntitySpec(ObjectSpec *spec)
|
||||
* @return value corresponding to the grf expected format:
|
||||
* Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline
|
||||
*/
|
||||
uint32 GetTerrainType(TileIndex tile, TileContext context)
|
||||
uint32_t GetTerrainType(TileIndex tile, TileContext context)
|
||||
{
|
||||
switch (_settings_game.game_creation.landscape) {
|
||||
case LT_TROPIC: return GetTropicZone(tile);
|
||||
@@ -405,8 +405,8 @@ uint32 GetTerrainType(TileIndex tile, TileContext context)
|
||||
*/
|
||||
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis)
|
||||
{
|
||||
int8 x = GB(parameter, 0, 4);
|
||||
int8 y = GB(parameter, 4, 4);
|
||||
int8_t x = GB(parameter, 0, 4);
|
||||
int8_t y = GB(parameter, 4, 4);
|
||||
|
||||
if (signed_offsets && x >= 8) x -= 16;
|
||||
if (signed_offsets && y >= 8) y -= 16;
|
||||
@@ -426,7 +426,7 @@ TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axi
|
||||
* @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8.
|
||||
* @return 0czzbbss: c = TileType; zz = TileZ; bb: 7-3 zero, 4-2 TerrainType, 1 water/shore, 0 zero; ss = TileSlope
|
||||
*/
|
||||
uint32 GetNearbyTileInformation(TileIndex tile, bool grf_version8)
|
||||
uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8)
|
||||
{
|
||||
TileType tile_type = GetTileType(tile);
|
||||
|
||||
@@ -447,7 +447,7 @@ uint32 GetNearbyTileInformation(TileIndex tile, bool grf_version8)
|
||||
* @param l Livery of the object; nullptr to use default.
|
||||
* @return NewGRF company information.
|
||||
*/
|
||||
uint32 GetCompanyInfo(CompanyID owner, const Livery *l)
|
||||
uint32_t GetCompanyInfo(CompanyID owner, const Livery *l)
|
||||
{
|
||||
if (l == nullptr && Company::IsValidID(owner)) l = &Company::Get(owner)->livery[LS_DEFAULT];
|
||||
return owner | (Company::IsValidAiID(owner) ? 0x10000 : 0) | (l != nullptr ? (l->colour1 << 24) | (l->colour2 << 28) : 0);
|
||||
@@ -460,7 +460,7 @@ uint32 GetCompanyInfo(CompanyID owner, const Livery *l)
|
||||
* @param default_error Error message to use for the generic error.
|
||||
* @return CommandCost indicating success or the error message.
|
||||
*/
|
||||
CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, const GRFFile *grffile, StringID default_error)
|
||||
CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, const GRFFile *grffile, StringID default_error)
|
||||
{
|
||||
CommandCost res;
|
||||
|
||||
@@ -496,7 +496,7 @@ CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, const GRFFi
|
||||
* @param cbid Callback causing the problem.
|
||||
* @param cb_res Invalid result returned by the callback.
|
||||
*/
|
||||
void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res)
|
||||
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
|
||||
{
|
||||
GRFConfig *grfconfig = GetGRFConfig(grfid);
|
||||
|
||||
@@ -526,7 +526,7 @@ void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res)
|
||||
* @param cb_res Callback result.
|
||||
* @return Boolean value. True if cb_res != 0.
|
||||
*/
|
||||
bool ConvertBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_res)
|
||||
bool ConvertBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
|
||||
{
|
||||
assert(cb_res != CALLBACK_FAILED); // We do not know what to return
|
||||
|
||||
@@ -545,7 +545,7 @@ bool ConvertBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_res)
|
||||
* @param cb_res Callback result.
|
||||
* @return Boolean value. True if cb_res != 0.
|
||||
*/
|
||||
bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_res)
|
||||
bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
|
||||
{
|
||||
assert(cb_res != CALLBACK_FAILED); // We do not know what to return
|
||||
|
||||
@@ -636,10 +636,10 @@ void NewGRFSpriteLayout::AllocateRegisters()
|
||||
* @param separate_ground Whether the ground sprite shall be resolved by a separate action-1-2-3 chain by default.
|
||||
* @return Bitmask of values for variable 10 to resolve action-1-2-3 chains for.
|
||||
*/
|
||||
uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_ground_offset, uint32 newgrf_offset, uint constr_stage, bool separate_ground) const
|
||||
uint32_t NewGRFSpriteLayout::PrepareLayout(uint32_t orig_offset, uint32_t newgrf_ground_offset, uint32_t newgrf_offset, uint constr_stage, bool separate_ground) const
|
||||
{
|
||||
result_seq.clear();
|
||||
uint32 var10_values = 0;
|
||||
uint32_t var10_values = 0;
|
||||
|
||||
/* Create a copy of the spritelayout, so we can modify some values.
|
||||
* Also include the groundsprite into the sequence for easier processing. */
|
||||
@@ -647,7 +647,7 @@ uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_groun
|
||||
result->image = ground;
|
||||
result->delta_x = 0;
|
||||
result->delta_y = 0;
|
||||
result->delta_z = (int8)0x80;
|
||||
result->delta_z = (int8_t)0x80;
|
||||
|
||||
const DrawTileSeqStruct *dtss;
|
||||
foreach_draw_tile_seq(dtss, this->seq) {
|
||||
@@ -664,7 +664,7 @@ uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_groun
|
||||
|
||||
/* Record var10 value for the sprite */
|
||||
if (HasBit(result->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE) || (flags & TLF_SPRITE_REG_FLAGS)) {
|
||||
uint8 var10 = (flags & TLF_SPRITE_VAR10) ? regs->sprite_var10 : (ground && separate_ground ? 1 : 0);
|
||||
uint8_t var10 = (flags & TLF_SPRITE_VAR10) ? regs->sprite_var10 : (ground && separate_ground ? 1 : 0);
|
||||
SetBit(var10_values, var10);
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_groun
|
||||
|
||||
/* Record var10 value for the palette */
|
||||
if (HasBit(result->image.pal, SPRITE_MODIFIER_CUSTOM_SPRITE) || (flags & TLF_PALETTE_REG_FLAGS)) {
|
||||
uint8 var10 = (flags & TLF_PALETTE_VAR10) ? regs->palette_var10 : (ground && separate_ground ? 1 : 0);
|
||||
uint8_t var10 = (flags & TLF_PALETTE_VAR10) ? regs->palette_var10 : (ground && separate_ground ? 1 : 0);
|
||||
SetBit(var10_values, var10);
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_groun
|
||||
* @param separate_ground Whether the ground sprite is resolved by a separate action-1-2-3 chain.
|
||||
* @return Resulting spritelayout after processing the registers.
|
||||
*/
|
||||
void NewGRFSpriteLayout::ProcessRegisters(uint8 resolved_var10, uint32 resolved_sprite, bool separate_ground) const
|
||||
void NewGRFSpriteLayout::ProcessRegisters(uint8_t resolved_var10, uint32_t resolved_sprite, bool separate_ground) const
|
||||
{
|
||||
DrawTileSeqStruct *result;
|
||||
const TileLayoutRegisters *regs = this->registers;
|
||||
@@ -719,7 +719,7 @@ void NewGRFSpriteLayout::ProcessRegisters(uint8 resolved_var10, uint32 resolved_
|
||||
/* Is the sprite or bounding box affected by an action-1-2-3 chain? */
|
||||
if (HasBit(result->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE) || (flags & TLF_SPRITE_REG_FLAGS)) {
|
||||
/* Does the var10 value apply to this sprite? */
|
||||
uint8 var10 = (flags & TLF_SPRITE_VAR10) ? regs->sprite_var10 : (ground && separate_ground ? 1 : 0);
|
||||
uint8_t var10 = (flags & TLF_SPRITE_VAR10) ? regs->sprite_var10 : (ground && separate_ground ? 1 : 0);
|
||||
if (var10 == resolved_var10) {
|
||||
/* Apply registers */
|
||||
if ((flags & TLF_DODRAW) && GetRegister(regs->dodraw) == 0) {
|
||||
@@ -727,7 +727,7 @@ void NewGRFSpriteLayout::ProcessRegisters(uint8 resolved_var10, uint32 resolved_
|
||||
} else {
|
||||
if (HasBit(result->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE)) result->image.sprite += resolved_sprite;
|
||||
if (flags & TLF_SPRITE) {
|
||||
int16 offset = (int16)GetRegister(regs->sprite); // mask to 16 bits to avoid trouble
|
||||
int16_t offset = (int16_t)GetRegister(regs->sprite); // mask to 16 bits to avoid trouble
|
||||
if (!HasBit(result->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE) || (offset >= 0 && offset < regs->max_sprite_offset)) {
|
||||
result->image.sprite += offset;
|
||||
} else {
|
||||
@@ -737,13 +737,13 @@ void NewGRFSpriteLayout::ProcessRegisters(uint8 resolved_var10, uint32 resolved_
|
||||
|
||||
if (result->IsParentSprite()) {
|
||||
if (flags & TLF_BB_XY_OFFSET) {
|
||||
result->delta_x += (int32)GetRegister(regs->delta.parent[0]);
|
||||
result->delta_y += (int32)GetRegister(regs->delta.parent[1]);
|
||||
result->delta_x += (int32_t)GetRegister(regs->delta.parent[0]);
|
||||
result->delta_y += (int32_t)GetRegister(regs->delta.parent[1]);
|
||||
}
|
||||
if (flags & TLF_BB_Z_OFFSET) result->delta_z += (int32)GetRegister(regs->delta.parent[2]);
|
||||
if (flags & TLF_BB_Z_OFFSET) result->delta_z += (int32_t)GetRegister(regs->delta.parent[2]);
|
||||
} else {
|
||||
if (flags & TLF_CHILD_X_OFFSET) result->delta_x += (int32)GetRegister(regs->delta.child[0]);
|
||||
if (flags & TLF_CHILD_Y_OFFSET) result->delta_y += (int32)GetRegister(regs->delta.child[1]);
|
||||
if (flags & TLF_CHILD_X_OFFSET) result->delta_x += (int32_t)GetRegister(regs->delta.child[0]);
|
||||
if (flags & TLF_CHILD_Y_OFFSET) result->delta_y += (int32_t)GetRegister(regs->delta.child[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -752,12 +752,12 @@ void NewGRFSpriteLayout::ProcessRegisters(uint8 resolved_var10, uint32 resolved_
|
||||
/* Is the palette affected by an action-1-2-3 chain? */
|
||||
if (result->image.sprite != 0 && (HasBit(result->image.pal, SPRITE_MODIFIER_CUSTOM_SPRITE) || (flags & TLF_PALETTE_REG_FLAGS))) {
|
||||
/* Does the var10 value apply to this sprite? */
|
||||
uint8 var10 = (flags & TLF_PALETTE_VAR10) ? regs->palette_var10 : (ground && separate_ground ? 1 : 0);
|
||||
uint8_t var10 = (flags & TLF_PALETTE_VAR10) ? regs->palette_var10 : (ground && separate_ground ? 1 : 0);
|
||||
if (var10 == resolved_var10) {
|
||||
/* Apply registers */
|
||||
if (HasBit(result->image.pal, SPRITE_MODIFIER_CUSTOM_SPRITE)) result->image.pal += resolved_sprite;
|
||||
if (flags & TLF_PALETTE) {
|
||||
int16 offset = (int16)GetRegister(regs->palette); // mask to 16 bits to avoid trouble
|
||||
int16_t offset = (int16_t)GetRegister(regs->palette); // mask to 16 bits to avoid trouble
|
||||
if (!HasBit(result->image.pal, SPRITE_MODIFIER_CUSTOM_SPRITE) || (offset >= 0 && offset < regs->max_palette_offset)) {
|
||||
result->image.pal += offset;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user