mirror of https://github.com/OpenTTD/OpenTTD
Codefix: Avoid using override keyword as member name.
Rename `GRFFileProps` `override` member to `override_id`.pull/13985/head
parent
294f826364
commit
91ab7f10cd
|
@ -135,7 +135,7 @@ struct HouseSpec {
|
||||||
inline HouseID GetTranslatedHouseID(HouseID hid)
|
inline HouseID GetTranslatedHouseID(HouseID hid)
|
||||||
{
|
{
|
||||||
const HouseSpec *hs = HouseSpec::Get(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 *);
|
void ShowBuildHousePicker(struct Window *);
|
||||||
|
|
|
@ -200,7 +200,7 @@ inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
|
||||||
if (gfx != 0xFF) {
|
if (gfx != 0xFF) {
|
||||||
assert(gfx < NUM_INDUSTRYTILES);
|
assert(gfx < NUM_INDUSTRYTILES);
|
||||||
const IndustryTileSpec *it = &_industry_tile_specs[gfx];
|
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 {
|
} else {
|
||||||
return gfx;
|
return gfx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
GrfMsg(2, "IndustriesChangeInfo: Attempt to override new industry {} with industry id {}. Ignoring.", ovrid, id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
indsp->grf_prop.override = ovrid;
|
indsp->grf_prop.override_id = ovrid;
|
||||||
_industry_mngr.Add(id, _cur.grffile->grfid, ovrid);
|
_industry_mngr.Add(id, _cur.grffile->grfid, ovrid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ AirportSpec AirportSpec::specs[NUM_AIRPORTS]; ///< Airport specifications.
|
||||||
if (subst_id == AT_INVALID) return as;
|
if (subst_id == AT_INVALID) return as;
|
||||||
as = &AirportSpec::specs[subst_id];
|
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;
|
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;
|
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;
|
overridden_as->enabled = false;
|
||||||
this->entity_overrides[i] = this->invalid_id;
|
this->entity_overrides[i] = this->invalid_id;
|
||||||
this->grfid_overrides[i] = 0;
|
this->grfid_overrides[i] = 0;
|
||||||
|
|
|
@ -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;
|
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;
|
overridden_airpts->enabled = false;
|
||||||
this->entity_overrides[i] = this->invalid_id;
|
this->entity_overrides[i] = this->invalid_id;
|
||||||
this->grfid_overrides[i] = 0;
|
this->grfid_overrides[i] = 0;
|
||||||
|
@ -98,7 +98,7 @@ void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts)
|
||||||
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
|
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
|
||||||
{
|
{
|
||||||
const AirportTileSpec *it = AirportTileSpec::Get(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?
|
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 */
|
/* 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
|
return 0xFF << 8 | gfx; // no. Tag FF + the gfx id of that tile
|
||||||
}
|
}
|
||||||
/* Overridden */
|
/* 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) {
|
if (tile_ovr->grf_prop.grfid == cur_grfid) {
|
||||||
return tile_ovr->grf_prop.local_id; // same grf file
|
return tile_ovr->grf_prop.local_id; // same grf 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;
|
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->entity_overrides[i] = this->invalid_id;
|
||||||
this->grfid_overrides[i] = 0;
|
this->grfid_overrides[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ void IndustryOverrideManager::SetEntitySpec(IndustrySpec *inds)
|
||||||
* Or it is a simple substitute.
|
* Or it is a simple substitute.
|
||||||
* We need to find a free available slot */
|
* 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);
|
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) {
|
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;
|
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;
|
overridden_its->enabled = false;
|
||||||
this->entity_overrides[i] = this->invalid_id;
|
this->entity_overrides[i] = this->invalid_id;
|
||||||
this->grfid_overrides[i] = 0;
|
this->grfid_overrides[i] = 0;
|
||||||
|
|
|
@ -340,10 +340,10 @@ struct VariableGRFFileProps : GRFFilePropsBase {
|
||||||
/** Data related to the handling of grf files. */
|
/** Data related to the handling of grf files. */
|
||||||
struct GRFFileProps : FixedGRFFileProps<1> {
|
struct GRFFileProps : FixedGRFFileProps<1> {
|
||||||
/** Set all default data constructor for the props. */
|
/** 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 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. */
|
/** Container for a label for rail or road type conversion. */
|
||||||
|
|
|
@ -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?
|
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 */
|
/* 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
|
return 0xFF << 8 | gfx; // no. Tag FF + the gfx id of that tile
|
||||||
}
|
}
|
||||||
/* Overridden */
|
/* 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) {
|
if (tile_ovr->grf_prop.grfid == cur_grfid) {
|
||||||
return tile_ovr->grf_prop.local_id; // same grf file
|
return tile_ovr->grf_prop.local_id; // same grf file
|
||||||
|
|
|
@ -2797,7 +2797,7 @@ static bool TryBuildTownHouse(Town *t, TileIndex tile)
|
||||||
/* Generate a list of all possible houses that can be built. */
|
/* Generate a list of all possible houses that can be built. */
|
||||||
for (const auto &hs : HouseSpec::Specs()) {
|
for (const auto &hs : HouseSpec::Specs()) {
|
||||||
/* Verify that the candidate house spec matches the current tile status */
|
/* 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. */
|
/* Don't let these counters overflow. Global counters are 32bit, there will never be that many houses. */
|
||||||
if (hs.class_id != HOUSE_NO_CLASS) {
|
if (hs.class_id != HOUSE_NO_CLASS) {
|
||||||
|
|
Loading…
Reference in New Issue