1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 21:43:06 +01:00

Use range-based for loops

This commit is contained in:
Hielke Morsink
2017-12-06 00:12:36 +01:00
committed by Michael Steenbeek
parent e3c52360db
commit 79aa4a99cf
6 changed files with 47 additions and 50 deletions

View File

@@ -337,12 +337,11 @@ void UITheme::SetName(const utf8 * name)
const UIThemeWindowEntry * UITheme::GetEntry(rct_windowclass windowClass) const
{
for (size_t i = 0; i < Entries.size(); i++)
for (const auto &entry : Entries)
{
const UIThemeWindowEntry * entry = &Entries[i];
if (entry->WindowClass == windowClass)
if (entry.WindowClass == windowClass)
{
return entry;
return &entry;
}
}
return nullptr;
@@ -351,12 +350,11 @@ const UIThemeWindowEntry * UITheme::GetEntry(rct_windowclass windowClass) const
void UITheme::SetEntry(const UIThemeWindowEntry * newEntry)
{
// Try to replace existing entry
for (size_t i = 0; i < Entries.size(); i++)
for (auto &entry : Entries)
{
UIThemeWindowEntry * entry = &Entries[i];
if (entry->WindowClass == newEntry->WindowClass)
if (entry.WindowClass == newEntry->WindowClass)
{
*entry = *newEntry;
entry = *newEntry;
return;
}
}