adjust settings_set to only accept one token per entry

radlights is now a set (only loads one though)
This commit is contained in:
Jonathan 2022-06-01 20:42:06 -04:00
parent aad711bb73
commit 65852ef042
3 changed files with 8 additions and 8 deletions

View File

@ -601,12 +601,12 @@ public:
bool parse(const std::string &settingName, parser_base_t &parser, bool locked = false) override
{
if (auto value = parseString(parser)) {
addValueFromParse(*value, locked);
return true;
}
if (!parser.parse_token(PARSE_PEEK))
return false;
return false;
parser.parse_token();
addValueFromParse(parser.token, locked);
return true;
}
inline bool copyFrom(const setting_base& other) override {

View File

@ -400,7 +400,7 @@ public:
setting_bool highlightseams{this, "highlightseams", false, &debug_group, ""};
setting_soft soft{this, "soft", 0, -1, std::numeric_limits<int32_t>::max(), &postprocessing_group,
"blurs the lightmap. specify n to blur radius in samples, otherwise auto"};
setting_string radlights{this, "radlights", "", "\"filename.rad\"", &experimental_group,
setting_set radlights{this, "radlights", "\"filename.rad\"", &experimental_group,
"loads a <surfacename> <r> <g> <b> <intensity> file"};
setting_int32 lmscale{
this, "lmscale", 0, &experimental_group, "change lightmap scale, vanilla engines only allow 16"};

View File

@ -120,8 +120,8 @@ void light_settings::postinitialize(int argc, const char **argv)
}
if (radlights.isChanged()) {
if (!ParseLightsFile(radlights.value())) {
logging::print("Unable to read surfacelights file {}\n", radlights.value());
if (!ParseLightsFile(*radlights.values().begin())) {
logging::print("Unable to read surfacelights file {}\n", *radlights.values().begin());
}
}