Codechange: Use std::vector for GRFConfig lists. (#10835)

This replaces the C-style custom managed linked-list and allows use of iterators etc.
This commit is contained in:
Peter Nelson
2025-01-31 17:09:09 +00:00
committed by GitHub
parent 40aeedeade
commit 5664b1e2f6
23 changed files with 248 additions and 384 deletions

View File

@@ -72,8 +72,6 @@ void NetworkGameListRemoveItem(NetworkGameList *remove)
prev_item->next = remove->next;
}
/* Remove GRFConfig information */
ClearGRFConfigList(remove->info.grfconfig);
delete remove;
NetworkRebuildHostList();
@@ -99,8 +97,6 @@ void NetworkGameListRemoveExpired()
item = item->next;
*prev_item = item;
/* Remove GRFConfig information */
ClearGRFConfigList(remove->info.grfconfig);
delete remove;
} else {
prev_item = &item->next;
@@ -121,7 +117,7 @@ void NetworkAfterNewGRFScan()
/* Reset compatibility state */
item->info.compatible = item->info.version_compatible;
for (GRFConfig *c = item->info.grfconfig; c != nullptr; c = c->next) {
for (auto &c : item->info.grfconfig) {
assert(HasBit(c->flags, GCF_COPY));
const GRFConfig *f = FindGRFConfig(c->ident.grfid, FGCM_EXACT, &c->ident.md5sum);