mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-25 08:22:17 +00: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:
+3
-3
@@ -273,8 +273,8 @@ void SurveyConfiguration(nlohmann::json &survey)
|
||||
if (BaseGraphics::GetUsedSet() != nullptr) {
|
||||
survey["graphics_set"] = fmt::format("{}.{}", BaseGraphics::GetUsedSet()->name, BaseGraphics::GetUsedSet()->version);
|
||||
const GRFConfig *extra_cfg = BaseGraphics::GetUsedSet()->GetExtraConfig();
|
||||
if (extra_cfg != nullptr && extra_cfg->num_params > 0) {
|
||||
survey["graphics_set_parameters"] = std::span<const uint32_t>(extra_cfg->param.data(), extra_cfg->num_params);
|
||||
if (extra_cfg != nullptr && !extra_cfg->param.empty()) {
|
||||
survey["graphics_set_parameters"] = std::span<const uint32_t>(extra_cfg->param);
|
||||
} else {
|
||||
survey["graphics_set_parameters"] = std::span<const uint32_t>();
|
||||
}
|
||||
@@ -370,7 +370,7 @@ void SurveyGrfs(nlohmann::json &survey)
|
||||
if ((c->palette & GRFP_BLT_MASK) == GRFP_BLT_32BPP) grf["blitter"] = "32bpp";
|
||||
|
||||
grf["is_static"] = HasBit(c->flags, GCF_STATIC);
|
||||
grf["parameters"] = std::span<const uint32_t>(c->param.data(), c->num_params);
|
||||
grf["parameters"] = std::span<const uint32_t>(c->param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user