1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-25 21:24:12 +01:00

Codechange: Use vector with unique_ptr instead of linked-list for base set lists. (#14332)

This commit is contained in:
Peter Nelson
2025-06-15 21:32:29 +01:00
committed by GitHub
parent e163aab892
commit cdd555edd5
5 changed files with 69 additions and 97 deletions

View File

@@ -480,7 +480,7 @@ template <>
const GraphicsSet *best = nullptr;
auto IsBetter = [&best] (const auto *current) {
auto IsBetter = [&best] (const GraphicsSet *current) {
/* Nothing chosen yet. */
if (best == nullptr) return true;
/* Not being a fallback is better. */
@@ -495,11 +495,11 @@ template <>
return best->palette != PAL_DOS && current->palette == PAL_DOS;
};
for (const GraphicsSet *c = BaseMedia<GraphicsSet>::available_sets; c != nullptr; c = c->next) {
for (const auto &c : BaseMedia<GraphicsSet>::available_sets) {
/* Skip unusable sets */
if (c->GetNumMissing() != 0) continue;
if (IsBetter(c)) best = c;
if (IsBetter(c.get())) best = c.get();
}
BaseMedia<GraphicsSet>::used_set = best;