Codechange: do not hide variables with other variables

This commit is contained in:
rubidium42
2023-01-28 20:06:51 +01:00
committed by rubidium42
parent 1951af07c0
commit 6ba55e663e
30 changed files with 137 additions and 146 deletions

View File

@@ -4270,13 +4270,13 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
int n = buf->ReadByte();
for (int j = 0; j != n; j++) {
RailTypeLabel label = buf->ReadDWord();
RailType rt = GetRailTypeByLabel(BSWAP32(label), false);
if (rt != INVALID_RAILTYPE) {
RailType resolved_rt = GetRailTypeByLabel(BSWAP32(label), false);
if (resolved_rt != INVALID_RAILTYPE) {
switch (prop) {
case 0x0F: SetBit(rti->powered_railtypes, rt); FALLTHROUGH; // Powered implies compatible.
case 0x0E: SetBit(rti->compatible_railtypes, rt); break;
case 0x18: SetBit(rti->introduction_required_railtypes, rt); break;
case 0x19: SetBit(rti->introduces_railtypes, rt); break;
case 0x0F: SetBit(rti->powered_railtypes, resolved_rt); FALLTHROUGH; // Powered implies compatible.
case 0x0E: SetBit(rti->compatible_railtypes, resolved_rt); break;
case 0x18: SetBit(rti->introduction_required_railtypes, resolved_rt); break;
case 0x19: SetBit(rti->introduces_railtypes, resolved_rt); break;
}
}
}
@@ -4484,12 +4484,12 @@ static ChangeInfoResult RoadTypeChangeInfo(uint id, int numinfo, int prop, ByteR
int n = buf->ReadByte();
for (int j = 0; j != n; j++) {
RoadTypeLabel label = buf->ReadDWord();
RoadType rt = GetRoadTypeByLabel(BSWAP32(label), false);
if (rt != INVALID_ROADTYPE) {
RoadType resolved_rt = GetRoadTypeByLabel(BSWAP32(label), false);
if (resolved_rt != INVALID_ROADTYPE) {
switch (prop) {
case 0x0F: SetBit(rti->powered_roadtypes, rt); break;
case 0x18: SetBit(rti->introduction_required_roadtypes, rt); break;
case 0x19: SetBit(rti->introduces_roadtypes, rt); break;
case 0x0F: SetBit(rti->powered_roadtypes, resolved_rt); break;
case 0x18: SetBit(rti->introduction_required_roadtypes, resolved_rt); break;
case 0x19: SetBit(rti->introduces_roadtypes, resolved_rt); break;
}
}
}