Codechange: Use std::map to provide indexed widget access.

This removes the need to determine the biggest widget index and replaces C-style memory handling.
This commit is contained in:
Peter Nelson
2023-10-16 11:13:36 +01:00
committed by Peter Nelson
parent a12f426d69
commit b86182ab84
16 changed files with 147 additions and 209 deletions

View File

@@ -646,9 +646,9 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
void OnTimeout() override
{
for (uint i = WID_ETT_START; i < this->nested_array_size; i++) {
if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons
this->RaiseWidgetWhenLowered(i);
for (const auto &pair : this->widget_lookup) {
if (pair.first < WID_ETT_START || (pair.first >= WID_ETT_BUTTONS_START && pair.first < WID_ETT_BUTTONS_END)) continue; // skip the buttons
this->RaiseWidgetWhenLowered(pair.first);
}
}