mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-23 04:04:09 +01:00
Codechange: range based for loops instead of C-style for loops
This commit is contained in:
@@ -747,16 +747,16 @@ protected:
|
||||
/* Rebuild colour indices if necessary. */
|
||||
if (SmallMapWindow::map_height_limit == _settings_game.construction.map_height_limit) return;
|
||||
|
||||
for (uint n = 0; n < lengthof(_heightmap_schemes); n++) {
|
||||
for (auto &heightmap_scheme : _heightmap_schemes) {
|
||||
/* The heights go from 0 up to and including maximum. */
|
||||
int heights = _settings_game.construction.map_height_limit + 1;
|
||||
_heightmap_schemes[n].height_colours = ReallocT<uint32_t>(_heightmap_schemes[n].height_colours, heights);
|
||||
heightmap_scheme.height_colours = ReallocT<uint32_t>(heightmap_scheme.height_colours, heights);
|
||||
|
||||
for (int z = 0; z < heights; z++) {
|
||||
size_t access_index = (_heightmap_schemes[n].colour_count * z) / heights;
|
||||
size_t access_index = (heightmap_scheme.colour_count * z) / heights;
|
||||
|
||||
/* Choose colour by mapping the range (0..max heightlevel) on the complete colour table. */
|
||||
_heightmap_schemes[n].height_colours[z] = _heightmap_schemes[n].height_colours_base[access_index];
|
||||
heightmap_scheme.height_colours[z] = heightmap_scheme.height_colours_base[access_index];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user