Codechange: range based for loops instead of C-style for loops

This commit is contained in:
Rubidium
2024-04-09 17:18:35 +02:00
committed by rubidium42
parent 2587a21400
commit 4f2412a272
19 changed files with 65 additions and 66 deletions

View File

@@ -2369,7 +2369,7 @@ bool AfterLoadGame()
uint8_t old_start;
uint8_t num_frames;
};
static const AirportTileConversion atc[] = {
static const AirportTileConversion atcs[] = {
{31, 12}, // APT_RADAR_GRASS_FENCE_SW
{50, 4}, // APT_GRASS_FENCE_NE_FLAG
{62, 2}, // 1 unused tile
@@ -2384,17 +2384,17 @@ bool AfterLoadGame()
if (IsAirportTile(t)) {
StationGfx old_gfx = GetStationGfx(t);
uint8_t offset = 0;
for (uint i = 0; i < lengthof(atc); i++) {
if (old_gfx < atc[i].old_start) {
for (const auto &atc : atcs) {
if (old_gfx < atc.old_start) {
SetStationGfx(t, old_gfx - offset);
break;
}
if (old_gfx < atc[i].old_start + atc[i].num_frames) {
SetAnimationFrame(t, old_gfx - atc[i].old_start);
SetStationGfx(t, atc[i].old_start - offset);
if (old_gfx < atc.old_start + atc.num_frames) {
SetAnimationFrame(t, old_gfx - atc.old_start);
SetStationGfx(t, atc.old_start - offset);
break;
}
offset += atc[i].num_frames - 1;
offset += atc.num_frames - 1;
}
}
}