mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 20:54:08 +01:00
Codechange: Store GRFConfig parameters in a vector. (#13137)
All GRFConfigs have space allocated for parameters, but only configured GRFConfigs need them. Using a vector instead means that space is only used when parameters are used.
This commit is contained in:
@@ -191,7 +191,7 @@ static void LoadSpriteTables()
|
||||
|
||||
/* Baseset extra graphics */
|
||||
GRFConfig *extra = new GRFConfig(used_set->GetOrCreateExtraConfig());
|
||||
if (extra->num_params == 0) extra->SetParameterDefaults();
|
||||
if (extra->param.empty()) extra->SetParameterDefaults();
|
||||
ClrBit(extra->flags, GCF_INIT_ONLY);
|
||||
|
||||
extra->next = top;
|
||||
@@ -397,7 +397,7 @@ bool GraphicsSet::IsConfigurable() const
|
||||
void GraphicsSet::CopyCompatibleConfig(const GraphicsSet &src)
|
||||
{
|
||||
const GRFConfig *src_cfg = src.GetExtraConfig();
|
||||
if (src_cfg == nullptr || src_cfg->num_params == 0) return;
|
||||
if (src_cfg == nullptr || src_cfg->param.empty()) return;
|
||||
GRFConfig &dest_cfg = this->GetOrCreateExtraConfig();
|
||||
if (dest_cfg.IsCompatible(src_cfg->version)) return;
|
||||
dest_cfg.CopyParams(*src_cfg);
|
||||
|
||||
Reference in New Issue
Block a user