Merge branch 'master' into jgrpp
# Conflicts: # src/base_station_base.h # src/newgrf_roadstop.cpp # src/newgrf_station.cpp # src/object_gui.cpp # src/saveload/settings_sl.cpp # src/saveload/station_sl.cpp # src/settings.cpp # src/settings_internal.h # src/timer/timer_game_calendar.cpp
This commit is contained in:
@@ -907,6 +907,11 @@ bool IntSettingDesc::IsDefaultValue(void *object) const
|
||||
return this->def == object_value;
|
||||
}
|
||||
|
||||
void IntSettingDesc::ResetToDefault(void *object) const
|
||||
{
|
||||
this->Write(object, this->def);
|
||||
}
|
||||
|
||||
char *StringSettingDesc::FormatValue(char *buf, const char *last, const void *object) const
|
||||
{
|
||||
const std::string &str = this->Read(object);
|
||||
@@ -942,6 +947,11 @@ bool StringSettingDesc::IsDefaultValue(void *object) const
|
||||
return this->def == str;
|
||||
}
|
||||
|
||||
void StringSettingDesc::ResetToDefault(void *object) const
|
||||
{
|
||||
this->Write(object, this->def);
|
||||
}
|
||||
|
||||
bool ListSettingDesc::IsSameValue(const IniItem *item, void *object) const
|
||||
{
|
||||
/* Checking for equality is way more expensive than just writing the value. */
|
||||
@@ -954,6 +964,12 @@ bool ListSettingDesc::IsDefaultValue(void *) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void ListSettingDesc::ResetToDefault(void *) const
|
||||
{
|
||||
/* Resetting a list to default is not supported. */
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all items from a 'grpname' section into a list
|
||||
* The list parameter can be a nullptr pointer, in this case nothing will be
|
||||
@@ -3937,3 +3953,13 @@ const SettingTable &GetLinkGraphSettingTable()
|
||||
{
|
||||
return _linkgraph_settings;
|
||||
}
|
||||
|
||||
void ResetSettingsToDefaultForLoad()
|
||||
{
|
||||
for (auto &sd : IterateSettingTables(GetSaveLoadSettingsTables())) {
|
||||
if (sd->flags & SF_NOT_IN_SAVE) continue;
|
||||
if ((sd->flags & SF_NO_NETWORK_SYNC) && _networking && !_network_server) continue;
|
||||
|
||||
sd->ResetToDefault(&_settings_game);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user