From b090c8e9bdd7ecf2cf37c1ddd337c6435e92933b Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 10 Jul 2024 10:23:49 +0100 Subject: [PATCH] Codechange: Replace default overrides arrays with std::pair and use range-for. This avoids indexed array access and use of lengthof. --- src/newgrf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f50ccb57d0..e78d15af51 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -10075,13 +10075,13 @@ void LoadNewGRF(uint load_index, uint num_baseset) } if (stage == GLS_RESERVE) { - static const uint32_t overrides[][2] = { + static const std::pair default_grf_overrides[] = { { 0x44442202, 0x44440111 }, // UKRS addons modifies UKRS { 0x6D620402, 0x6D620401 }, // DBSetXL ECS extension modifies DBSetXL { 0x4D656f20, 0x4D656F17 }, // LV4cut modifies LV4 }; - for (size_t i = 0; i < lengthof(overrides); i++) { - SetNewGRFOverride(BSWAP32(overrides[i][0]), BSWAP32(overrides[i][1])); + for (const auto &grf_override : default_grf_overrides) { + SetNewGRFOverride(BSWAP32(grf_override.first), BSWAP32(grf_override.second)); } }