Codechange: use std::string for formatting settings

This commit is contained in:
Rubidium
2023-05-24 21:35:11 +02:00
committed by rubidium42
parent 1412ea48ed
commit f4b0ac2bd4
3 changed files with 46 additions and 54 deletions

View File

@@ -106,16 +106,13 @@ static auto &GenericSettingTables()
*/
static void SurveySettingsTable(nlohmann::json &survey, const SettingTable &table, void *object)
{
char buf[512];
for (auto &desc : table) {
const SettingDesc *sd = GetSettingDesc(desc);
/* Skip any old settings we no longer save/load. */
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
auto name = sd->GetName();
sd->FormatValue(buf, lastof(buf), object);
survey[name] = buf;
survey[name] = sd->FormatValue(object);
}
}