Codechange: Define GRFConfigList alias and pass by reference. (#13358)

This adds the distinction between a single GRFConfig and a GRFConfig list, and simplifies how GRFConfig lists are passed to various functions.
This commit is contained in:
Peter Nelson
2025-01-22 22:30:32 +00:00
committed by GitHub
parent b1ab1b9f06
commit f6ab2b69c6
21 changed files with 127 additions and 120 deletions

View File

@@ -106,17 +106,17 @@ struct NGRFChunkHandler : ChunkHandler {
config.param.assign(std::begin(param), last);
}
void LoadCommon(GRFConfig *&grfconfig) const
void LoadCommon(GRFConfigList &grfconfig) const
{
const std::vector<SaveLoad> slt = SlCompatTableHeader(description, _grfconfig_sl_compat);
ClearGRFConfigList(&grfconfig);
ClearGRFConfigList(grfconfig);
while (SlIterateArray() != -1) {
GRFConfig *c = new GRFConfig();
SlObject(c, slt);
if (IsSavegameVersionBefore(SLV_101)) c->SetSuitablePalette();
this->LoadParameters(*c);
AppendToGRFConfigList(&grfconfig, c);
AppendToGRFConfigList(grfconfig, c);
}
}
@@ -132,7 +132,7 @@ struct NGRFChunkHandler : ChunkHandler {
ResetGRFConfig(false);
} else {
/* Append static NewGRF configuration */
AppendStaticGRFConfigs(&_grfconfig);
AppendStaticGRFConfigs(_grfconfig);
}
}