Add setting flag to run string setting change callbacks on config load

This commit is contained in:
Jonathan G Rennison
2022-01-03 00:01:21 +00:00
parent 26eca815d3
commit 87f0c20bc0
2 changed files with 5 additions and 0 deletions

View File

@@ -662,6 +662,10 @@ void StringSettingDesc::ParseValue(const IniItem *item, void *object) const
{
std::string str = (item == nullptr) ? this->def : item->value.value_or("");
this->MakeValueValid(str);
if (this->flags & SF_RUN_CALLBACKS_ON_PARSE) {
if (this->pre_check != nullptr && !this->pre_check(str)) str = this->def;
if (this->post_callback != nullptr) this->post_callback(str);
}
this->Write(object, str);
}