1
0
Fork 0

Codefix: Avoid using override keyword as member name.

Rename `GRFFileProps` `override` member to `override_id`.
pull/13985/head
Peter Nelson 2025-04-09 08:47:18 +01:00 committed by Peter Nelson
parent 294f826364
commit 91ab7f10cd
9 changed files with 17 additions and 17 deletions

View File

@ -135,7 +135,7 @@ struct HouseSpec {
inline HouseID GetTranslatedHouseID(HouseID hid)
{
const HouseSpec *hs = HouseSpec::Get(hid);
return hs->grf_prop.override == INVALID_HOUSE_ID ? hid : hs->grf_prop.override;
return hs->grf_prop.override_id == INVALID_HOUSE_ID ? hid : hs->grf_prop.override_id;
}
void ShowBuildHousePicker(struct Window *);

View File

@ -200,7 +200,7 @@ inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
if (gfx != 0xFF) {
assert(gfx < NUM_INDUSTRYTILES);
const IndustryTileSpec *it = &_industry_tile_specs[gfx];
return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
return it->grf_prop.override_id == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override_id;
} else {
return gfx;
}

View File

@ -394,7 +394,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
GrfMsg(2, "IndustriesChangeInfo: Attempt to override new industry {} with industry id {}. Ignoring.", ovrid, id);
continue;
}
indsp->grf_prop.override = ovrid;
indsp->grf_prop.override_id = ovrid;
_industry_mngr.Add(id, _cur.grffile->grfid, ovrid);
break;
}

View File

@ -66,7 +66,7 @@ AirportSpec AirportSpec::specs[NUM_AIRPORTS]; ///< Airport specifications.
if (subst_id == AT_INVALID) return as;
as = &AirportSpec::specs[subst_id];
}
if (as->grf_prop.override != AT_INVALID) return &AirportSpec::specs[as->grf_prop.override];
if (as->grf_prop.override_id != AT_INVALID) return &AirportSpec::specs[as->grf_prop.override_id];
return as;
}
@ -151,7 +151,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
if (this->entity_overrides[i] != as->grf_prop.local_id || this->grfid_overrides[i] != as->grf_prop.grfid) continue;
overridden_as->grf_prop.override = airport_id;
overridden_as->grf_prop.override_id = airport_id;
overridden_as->enabled = false;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;

View File

@ -83,7 +83,7 @@ void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts)
if (this->entity_overrides[i] != airpts->grf_prop.local_id || this->grfid_overrides[i] != airpts->grf_prop.grfid) continue;
overridden_airpts->grf_prop.override = airpt_id;
overridden_airpts->grf_prop.override_id = airpt_id;
overridden_airpts->enabled = false;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;
@ -98,7 +98,7 @@ void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts)
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
{
const AirportTileSpec *it = AirportTileSpec::Get(gfx);
return it->grf_prop.override == INVALID_AIRPORTTILE ? gfx : it->grf_prop.override;
return it->grf_prop.override_id == INVALID_AIRPORTTILE ? gfx : it->grf_prop.override_id;
}
/**
@ -137,11 +137,11 @@ static uint32_t GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint
if (gfx < NEW_AIRPORTTILE_OFFSET) { // Does it belongs to an old type?
/* It is an old tile. We have to see if it's been overridden */
if (ats->grf_prop.override == INVALID_AIRPORTTILE) { // has it been overridden?
if (ats->grf_prop.override_id == INVALID_AIRPORTTILE) { // has it been overridden?
return 0xFF << 8 | gfx; // no. Tag FF + the gfx id of that tile
}
/* Overridden */
const AirportTileSpec *tile_ovr = AirportTileSpec::Get(ats->grf_prop.override);
const AirportTileSpec *tile_ovr = AirportTileSpec::Get(ats->grf_prop.override_id);
if (tile_ovr->grf_prop.grfid == cur_grfid) {
return tile_ovr->grf_prop.local_id; // same grf file

View File

@ -178,7 +178,7 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs)
if (this->entity_overrides[i] != hs->grf_prop.local_id || this->grfid_overrides[i] != hs->grf_prop.grfid) continue;
overridden_hs->grf_prop.override = house_id;
overridden_hs->grf_prop.override_id = house_id;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;
}
@ -256,7 +256,7 @@ void IndustryOverrideManager::SetEntitySpec(IndustrySpec *inds)
* Or it is a simple substitute.
* We need to find a free available slot */
ind_id = this->AddEntityID(inds->grf_prop.local_id, inds->grf_prop.grfid, inds->grf_prop.subst_id);
inds->grf_prop.override = this->invalid_id; // make sure it will not be detected as overridden
inds->grf_prop.override_id = this->invalid_id; // make sure it will not be detected as overridden
}
if (ind_id == this->invalid_id) {
@ -287,7 +287,7 @@ void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its)
if (this->entity_overrides[i] != its->grf_prop.local_id || this->grfid_overrides[i] != its->grf_prop.grfid) continue;
overridden_its->grf_prop.override = indt_id;
overridden_its->grf_prop.override_id = indt_id;
overridden_its->enabled = false;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;

View File

@ -340,10 +340,10 @@ struct VariableGRFFileProps : GRFFilePropsBase {
/** Data related to the handling of grf files. */
struct GRFFileProps : FixedGRFFileProps<1> {
/** Set all default data constructor for the props. */
constexpr GRFFileProps(uint16_t subst_id = 0) : subst_id(subst_id), override(subst_id) {}
constexpr GRFFileProps(uint16_t subst_id = 0) : subst_id(subst_id), override_id(subst_id) {}
uint16_t subst_id;
uint16_t override; ///< id of the entity been replaced by
uint16_t override_id; ///< id of the entity been replaced by
};
/** Container for a label for rail or road type conversion. */

View File

@ -66,11 +66,11 @@ uint32_t GetIndustryIDAtOffset(TileIndex tile, const Industry *i, uint32_t cur_g
if (gfx < NEW_INDUSTRYTILEOFFSET) { // Does it belongs to an old type?
/* It is an old tile. We have to see if it's been overridden */
if (indtsp->grf_prop.override == INVALID_INDUSTRYTILE) { // has it been overridden?
if (indtsp->grf_prop.override_id == INVALID_INDUSTRYTILE) { // has it been overridden?
return 0xFF << 8 | gfx; // no. Tag FF + the gfx id of that tile
}
/* Overridden */
const IndustryTileSpec *tile_ovr = GetIndustryTileSpec(indtsp->grf_prop.override);
const IndustryTileSpec *tile_ovr = GetIndustryTileSpec(indtsp->grf_prop.override_id);
if (tile_ovr->grf_prop.grfid == cur_grfid) {
return tile_ovr->grf_prop.local_id; // same grf file

View File

@ -2797,7 +2797,7 @@ static bool TryBuildTownHouse(Town *t, TileIndex tile)
/* Generate a list of all possible houses that can be built. */
for (const auto &hs : HouseSpec::Specs()) {
/* Verify that the candidate house spec matches the current tile status */
if ((~hs.building_availability & bitmask) != 0 || !hs.enabled || hs.grf_prop.override != INVALID_HOUSE_ID) continue;
if ((~hs.building_availability & bitmask) != 0 || !hs.enabled || hs.grf_prop.override_id != INVALID_HOUSE_ID) continue;
/* Don't let these counters overflow. Global counters are 32bit, there will never be that many houses. */
if (hs.class_id != HOUSE_NO_CLASS) {