summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp156
1 files changed, 78 insertions, 78 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 749050132..b111f8728 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -96,7 +96,7 @@ static const char * const _list_group_names[] = {
"newgrf",
"servers",
"server_bind_addresses",
- NULL
+ nullptr
};
/**
@@ -114,7 +114,7 @@ static size_t LookupOneOfMany(const char *many, const char *one, size_t onelen =
if (onelen == 0) onelen = strlen(one);
/* check if it's an integer */
- if (*one >= '0' && *one <= '9') return strtoul(one, NULL, 0);
+ if (*one >= '0' && *one <= '9') return strtoul(one, nullptr, 0);
idx = 0;
for (;;) {
@@ -218,7 +218,7 @@ static bool LoadIntList(const char *str, void *array, int nelems, VarType type)
int items[64];
int i, nitems;
- if (str == NULL) {
+ if (str == nullptr) {
memset(items, 0, sizeof(items));
nitems = nelems;
} else {
@@ -348,7 +348,7 @@ static void MakeManyOfMany(char *buf, const char *last, const char *many, uint32
*/
static const void *StringToVal(const SettingDescBase *desc, const char *orig_str)
{
- const char *str = orig_str == NULL ? "" : orig_str;
+ const char *str = orig_str == nullptr ? "" : orig_str;
switch (desc->cmd) {
case SDT_NUMX: {
@@ -373,7 +373,7 @@ static const void *StringToVal(const SettingDescBase *desc, const char *orig_str
size_t r = LookupOneOfMany(desc->many, str);
/* if the first attempt of conversion from string to the appropriate value fails,
* look if we have defined a converter from old value to new value. */
- if (r == (size_t)-1 && desc->proc_cnvt != NULL) r = desc->proc_cnvt(str);
+ if (r == (size_t)-1 && desc->proc_cnvt != nullptr) r = desc->proc_cnvt(str);
if (r != (size_t)-1) return (void*)r; // and here goes converted value
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_VALUE);
@@ -409,7 +409,7 @@ static const void *StringToVal(const SettingDescBase *desc, const char *orig_str
default: break;
}
- return NULL;
+ return nullptr;
}
/**
@@ -508,7 +508,7 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
/* For settings.xx.yy load the settings from [xx] yy = ? */
s = strchr(sdb->name, '.');
- if (s != NULL) {
+ if (s != nullptr) {
group = ini->GetGroup(sdb->name, s - sdb->name);
s++;
} else {
@@ -517,19 +517,19 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
}
item = group->GetItem(s, false);
- if (item == NULL && group != group_def) {
+ if (item == nullptr && group != group_def) {
/* For settings.xx.yy load the settings from [settingss] yy = ? in case the previous
* did not exist (e.g. loading old config files with a [settings] section */
item = group_def->GetItem(s, false);
}
- if (item == NULL) {
+ if (item == nullptr) {
/* For settings.xx.zz.yy load the settings from [zz] yy = ? in case the previous
* did not exist (e.g. loading old config files with a [yapf] section */
const char *sc = strchr(s, '.');
- if (sc != NULL) item = ini->GetGroup(s, sc - s)->GetItem(sc + 1, false);
+ if (sc != nullptr) item = ini->GetGroup(s, sc - s)->GetItem(sc + 1, false);
}
- p = (item == NULL) ? sdb->def : StringToVal(sdb, item->value);
+ p = (item == nullptr) ? sdb->def : StringToVal(sdb, item->value);
ptr = GetVariableAddress(object, sld);
switch (sdb->cmd) {
@@ -544,16 +544,16 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
switch (GetVarMemType(sld->conv)) {
case SLE_VAR_STRB:
case SLE_VAR_STRBQ:
- if (p != NULL) strecpy((char*)ptr, (const char*)p, (char*)ptr + sld->length - 1);
+ if (p != nullptr) strecpy((char*)ptr, (const char*)p, (char*)ptr + sld->length - 1);
break;
case SLE_VAR_STR:
case SLE_VAR_STRQ:
free(*(char**)ptr);
- *(char**)ptr = p == NULL ? NULL : stredup((const char*)p);
+ *(char**)ptr = p == nullptr ? nullptr : stredup((const char*)p);
break;
- case SLE_VAR_CHAR: if (p != NULL) *(char *)ptr = *(const char *)p; break;
+ case SLE_VAR_CHAR: if (p != nullptr) *(char *)ptr = *(const char *)p; break;
default: NOT_REACHED();
}
@@ -567,7 +567,7 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
/* Use default */
LoadIntList((const char*)sdb->def, ptr, sld->length, GetVarMemType(sld->conv));
- } else if (sd->desc.proc_cnvt != NULL) {
+ } else if (sd->desc.proc_cnvt != nullptr) {
sd->desc.proc_cnvt((const char*)p);
}
break;
@@ -591,7 +591,7 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
*/
static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object)
{
- IniGroup *group_def = NULL, *group;
+ IniGroup *group_def = nullptr, *group;
IniItem *item;
char buf[512];
const char *s;
@@ -608,11 +608,11 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
/* XXX - wtf is this?? (group override?) */
s = strchr(sdb->name, '.');
- if (s != NULL) {
+ if (s != nullptr) {
group = ini->GetGroup(sdb->name, s - sdb->name);
s++;
} else {
- if (group_def == NULL) group_def = ini->GetGroup(grpname);
+ if (group_def == nullptr) group_def = ini->GetGroup(grpname);
s = sdb->name;
group = group_def;
}
@@ -620,7 +620,7 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
item = group->GetItem(s, true);
ptr = GetVariableAddress(object, sld);
- if (item->value != NULL) {
+ if (item->value != nullptr) {
/* check if the value is the same as the old value */
const void *p = StringToVal(sdb, item->value);
@@ -633,7 +633,7 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
case SDT_MANYOFMANY:
switch (GetVarMemType(sld->conv)) {
case SLE_VAR_BL:
- if (*(bool*)ptr == (p != NULL)) continue;
+ if (*(bool*)ptr == (p != nullptr)) continue;
break;
case SLE_VAR_I8:
@@ -684,7 +684,7 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
case SLE_VAR_STR: strecpy(buf, *(char**)ptr, lastof(buf)); break;
case SLE_VAR_STRQ:
- if (*(char**)ptr == NULL) {
+ if (*(char**)ptr == nullptr) {
buf[0] = '\0';
} else {
seprintf(buf, lastof(buf), "\"%s\"", *(char**)ptr);
@@ -711,7 +711,7 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
/**
* Loads all items from a 'grpname' section into a list
- * The list parameter can be a NULL pointer, in this case nothing will be
+ * The list parameter can be a nullptr pointer, in this case nothing will be
* saved and a callback function should be defined that will take over the
* list-handling and store the data itself somewhere.
* @param ini IniFile handle to the ini file with the source data
@@ -722,18 +722,18 @@ static void IniLoadSettingList(IniFile *ini, const char *grpname, StringList &li
{
IniGroup *group = ini->GetGroup(grpname);
- if (group == NULL) return;
+ if (group == nullptr) return;
list.clear();
- for (const IniItem *item = group->item; item != NULL; item = item->next) {
- if (item->name != NULL) list.emplace_back(item->name);
+ for (const IniItem *item = group->item; item != nullptr; item = item->next) {
+ if (item->name != nullptr) list.emplace_back(item->name);
}
}
/**
* Saves all items from a list into the 'grpname' section
- * The list parameter can be a NULL pointer, in this case a callback function
+ * The list parameter can be a nullptr pointer, in this case a callback function
* should be defined that will provide the source data to be saved.
* @param ini IniFile handle to the ini file where the destination data is saved
* @param grpname character string identifying the section-header of the ini file
@@ -744,7 +744,7 @@ static void IniSaveSettingList(IniFile *ini, const char *grpname, StringList &li
{
IniGroup *group = ini->GetGroup(grpname);
- if (group == NULL) return;
+ if (group == nullptr) return;
group->Clear();
for (const auto &iter : list) {
@@ -805,7 +805,7 @@ SettingType SettingDesc::GetType() const
/** Reposition the main toolbar as the setting changed. */
static bool v_PositionMainToolbar(int32 p1)
{
- if (_game_mode != GM_MENU) PositionMainToolbar(NULL);
+ if (_game_mode != GM_MENU) PositionMainToolbar(nullptr);
return true;
}
@@ -813,9 +813,9 @@ static bool v_PositionMainToolbar(int32 p1)
static bool v_PositionStatusbar(int32 p1)
{
if (_game_mode != GM_MENU) {
- PositionStatusbar(NULL);
- PositionNewsMessage(NULL);
- PositionNetworkChatWindow(NULL);
+ PositionStatusbar(nullptr);
+ PositionNewsMessage(nullptr);
+ PositionNetworkChatWindow(nullptr);
}
return true;
}
@@ -1416,14 +1416,14 @@ static void AILoadConfig(IniFile *ini, const char *grpname)
/* Clean any configured AI */
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
- AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME)->Change(NULL);
+ AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME)->Change(nullptr);
}
/* If no group exists, return */
- if (group == NULL) return;
+ if (group == nullptr) return;
CompanyID c = COMPANY_FIRST;
- for (item = group->item; c < MAX_COMPANIES && item != NULL; c++, item = item->next) {
+ for (item = group->item; c < MAX_COMPANIES && item != nullptr; c++, item = item->next) {
AIConfig *config = AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME);
config->Change(item->name);
@@ -1433,7 +1433,7 @@ static void AILoadConfig(IniFile *ini, const char *grpname)
continue;
}
}
- if (item->value != NULL) config->StringToSettings(item->value);
+ if (item->value != nullptr) config->StringToSettings(item->value);
}
}
@@ -1443,13 +1443,13 @@ static void GameLoadConfig(IniFile *ini, const char *grpname)
IniItem *item;
/* Clean any configured GameScript */
- GameConfig::GetConfig(GameConfig::SSS_FORCE_NEWGAME)->Change(NULL);
+ GameConfig::GetConfig(GameConfig::SSS_FORCE_NEWGAME)->Change(nullptr);
/* If no group exists, return */
- if (group == NULL) return;
+ if (group == nullptr) return;
item = group->item;
- if (item == NULL) return;
+ if (item == nullptr) return;
GameConfig *config = GameConfig::GetConfig(AIConfig::SSS_FORCE_NEWGAME);
@@ -1460,7 +1460,7 @@ static void GameLoadConfig(IniFile *ini, const char *grpname)
return;
}
}
- if (item->value != NULL) config->StringToSettings(item->value);
+ if (item->value != nullptr) config->StringToSettings(item->value);
}
/**
@@ -1507,13 +1507,13 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
{
IniGroup *group = ini->GetGroup(grpname);
IniItem *item;
- GRFConfig *first = NULL;
+ GRFConfig *first = nullptr;
GRFConfig **curr = &first;
- if (group == NULL) return NULL;
+ if (group == nullptr) return nullptr;
- for (item = group->item; item != NULL; item = item->next) {
- GRFConfig *c = NULL;
+ for (item = group->item; item != nullptr; item = item->next) {
+ GRFConfig *c = nullptr;
uint8 grfid_buf[4], md5sum[16];
char *filename = item->name;
@@ -1530,14 +1530,14 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
uint32 grfid = grfid_buf[0] | (grfid_buf[1] << 8) | (grfid_buf[2] << 16) | (grfid_buf[3] << 24);
if (has_md5sum) {
const GRFConfig *s = FindGRFConfig(grfid, FGCM_EXACT, md5sum);
- if (s != NULL) c = new GRFConfig(*s);
+ if (s != nullptr) c = new GRFConfig(*s);
}
- if (c == NULL && !FioCheckFileExists(filename, NEWGRF_DIR)) {
+ if (c == nullptr && !FioCheckFileExists(filename, NEWGRF_DIR)) {
const GRFConfig *s = FindGRFConfig(grfid, FGCM_NEWEST_VALID);
- if (s != NULL) c = new GRFConfig(*s);
+ if (s != nullptr) c = new GRFConfig(*s);
}
}
- if (c == NULL) c = new GRFConfig(filename);
+ if (c == nullptr) c = new GRFConfig(filename);
/* Parse parameters */
if (!StrEmpty(item->value)) {
@@ -1572,7 +1572,7 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
/* Check for duplicate GRFID (will also check for duplicate filenames) */
bool duplicate = false;
- for (const GRFConfig *gc = first; gc != NULL; gc = gc->next) {
+ for (const GRFConfig *gc = first; gc != nullptr; gc = gc->next) {
if (gc->ident.grfid == c->ident.grfid) {
SetDParamStr(0, c->filename);
SetDParamStr(1, gc->filename);
@@ -1601,7 +1601,7 @@ static void AISaveConfig(IniFile *ini, const char *grpname)
{
IniGroup *group = ini->GetGroup(grpname);
- if (group == NULL) return;
+ if (group == nullptr) return;
group->Clear();
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
@@ -1625,7 +1625,7 @@ static void GameSaveConfig(IniFile *ini, const char *grpname)
{
IniGroup *group = ini->GetGroup(grpname);
- if (group == NULL) return;
+ if (group == nullptr) return;
group->Clear();
GameConfig *config = GameConfig::GetConfig(AIConfig::SSS_FORCE_NEWGAME);
@@ -1671,7 +1671,7 @@ static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *li
IniGroup *group = ini->GetGroup(grpname);
const GRFConfig *c;
- for (c = list; c != NULL; c = c->next) {
+ for (c = list; c != nullptr; c = c->next) {
/* Hex grfid (4 bytes in nibbles), "|", hex md5sum (16 bytes in nibbles), "|", file system path. */
char key[4 * 2 + 1 + 16 * 2 + 1 + MAX_PATH];
char params[512];
@@ -1688,9 +1688,9 @@ static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *li
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list, bool basic_settings = true, bool other_settings = true)
{
if (basic_settings) {
- proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL);
+ proc(ini, (const SettingDesc*)_misc_settings, "misc", nullptr);
#if defined(_WIN32) && !defined(DEDICATED)
- proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL);
+ proc(ini, (const SettingDesc*)_win32_settings, "win32", nullptr);
#endif /* _WIN32 */
}
@@ -1739,7 +1739,7 @@ void LoadFromConfig(bool minimal)
/* Display sheduled errors */
extern void ScheduleErrorMessage(ErrorList &datas);
ScheduleErrorMessage(_settings_error_list);
- if (FindWindowById(WC_ERRMSG, 0) == NULL) ShowFirstError();
+ if (FindWindowById(WC_ERRMSG, 0) == nullptr) ShowFirstError();
}
delete ini;
@@ -1774,7 +1774,7 @@ StringList GetGRFPresetList()
StringList list;
std::unique_ptr<IniFile> ini(IniLoadConfig());
- for (IniGroup *group = ini->group; group != NULL; group = group->next) {
+ for (IniGroup *group = ini->group; group != nullptr; group = group->next) {
if (strncmp(group->name, "preset-", 7) == 0) {
list.emplace_back(group->name + 7);
}
@@ -1838,7 +1838,7 @@ void DeleteGRFPresetFromConfig(const char *config_name)
const SettingDesc *GetSettingDescription(uint index)
{
- if (index >= lengthof(_settings)) return NULL;
+ if (index >= lengthof(_settings)) return nullptr;
return &_settings[index];
}
@@ -1857,7 +1857,7 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
{
const SettingDesc *sd = GetSettingDescription(p1);
- if (sd == NULL) return CMD_ERROR;
+ if (sd == nullptr) return CMD_ERROR;
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR;
if (!sd->IsEditable(true)) return CMD_ERROR;
@@ -1873,7 +1873,7 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (oldval == newval) return CommandCost();
- if (sd->desc.proc != NULL && !sd->desc.proc(newval)) {
+ if (sd->desc.proc != nullptr && !sd->desc.proc(newval)) {
WriteValue(var, sd->save.conv, (int64)oldval);
return CommandCost();
}
@@ -1916,7 +1916,7 @@ CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32
if (oldval == newval) return CommandCost();
- if (sd->desc.proc != NULL && !sd->desc.proc(newval)) {
+ if (sd->desc.proc != nullptr && !sd->desc.proc(newval)) {
WriteValue(var, sd->save.conv, (int64)oldval);
return CommandCost();
}
@@ -1949,7 +1949,7 @@ bool SetSettingValue(uint index, int32 value, bool force_newgame)
void *var2 = GetVariableAddress(&_settings_newgame, &sd->save);
Write_ValidateSetting(var2, sd, value);
}
- if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
+ if (sd->desc.proc != nullptr) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
SetWindowClassesDirty(WC_GAME_OPTIONS);
@@ -1983,7 +1983,7 @@ void SetCompanySetting(uint index, int32 value)
} else {
void *var = GetVariableAddress(&_settings_client.company, &sd->save);
Write_ValidateSetting(var, sd, value);
- if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
+ if (sd->desc.proc != nullptr) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
}
}
@@ -2012,7 +2012,7 @@ void SyncCompanySettings()
const void *new_var = GetVariableAddress(&_settings_client.company, &sd->save);
uint32 old_value = (uint32)ReadValue(old_var, sd->save.conv);
uint32 new_value = (uint32)ReadValue(new_var, sd->save.conv);
- if (old_value != new_value) NetworkSendCommand(0, i, new_value, CMD_CHANGE_COMPANY_SETTING, NULL, NULL, _local_company);
+ if (old_value != new_value) NetworkSendCommand(0, i, new_value, CMD_CHANGE_COMPANY_SETTING, nullptr, nullptr, _local_company);
}
}
@@ -2025,7 +2025,7 @@ uint GetCompanySettingIndex(const char *name)
{
uint i;
const SettingDesc *sd = GetSettingFromName(name, &i);
- assert(sd != NULL && (sd->desc.flags & SGF_PER_COMPANY) != 0);
+ assert(sd != nullptr && (sd->desc.flags & SGF_PER_COMPANY) != 0);
return i;
}
@@ -2044,12 +2044,12 @@ bool SetSettingValue(uint index, const char *value, bool force_newgame)
if (GetVarMemType(sd->save.conv) == SLE_VAR_STRQ) {
char **var = (char**)GetVariableAddress((_game_mode == GM_MENU || force_newgame) ? &_settings_newgame : &_settings_game, &sd->save);
free(*var);
- *var = strcmp(value, "(null)") == 0 ? NULL : stredup(value);
+ *var = strcmp(value, "(null)") == 0 ? nullptr : stredup(value);
} else {
- char *var = (char*)GetVariableAddress(NULL, &sd->save);
+ char *var = (char*)GetVariableAddress(nullptr, &sd->save);
strecpy(var, value, &var[sd->save.length - 1]);
}
- if (sd->desc.proc != NULL) sd->desc.proc(0);
+ if (sd->desc.proc != nullptr) sd->desc.proc(0);
return true;
}
@@ -2059,7 +2059,7 @@ bool SetSettingValue(uint index, const char *value, bool force_newgame)
* @param name Name of the setting to return a setting description of
* @param i Pointer to an integer that will contain the index of the setting after the call, if it is successful.
* @return Pointer to the setting description of setting \a name if it can be found,
- * \c NULL indicates failure to obtain the description
+ * \c nullptr indicates failure to obtain the description
*/
const SettingDesc *GetSettingFromName(const char *name, uint *i)
{
@@ -2075,7 +2075,7 @@ const SettingDesc *GetSettingFromName(const char *name, uint *i)
for (*i = 0, sd = _settings; sd->save.cmd != SL_END; sd++, (*i)++) {
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
const char *short_name = strchr(sd->desc.name, '.');
- if (short_name != NULL) {
+ if (short_name != nullptr) {
short_name++;
if (strcmp(short_name, name) == 0) return sd;
}
@@ -2088,7 +2088,7 @@ const SettingDesc *GetSettingFromName(const char *name, uint *i)
if (strcmp(sd->desc.name, name) == 0) return sd;
}
- return NULL;
+ return nullptr;
}
/* Those 2 functions need to be here, else we have to make some stuff non-static
@@ -2098,7 +2098,7 @@ void IConsoleSetSetting(const char *name, const char *value, bool force_newgame)
uint index;
const SettingDesc *sd = GetSettingFromName(name, &index);
- if (sd == NULL) {
+ if (sd == nullptr) {
IConsolePrintF(CC_WARNING, "'%s' is an unknown setting.", name);
return;
}
@@ -2131,7 +2131,7 @@ void IConsoleSetSetting(const char *name, int value)
{
uint index;
const SettingDesc *sd = GetSettingFromName(name, &index);
- assert(sd != NULL);
+ assert(sd != nullptr);
SetSettingValue(index, value);
}
@@ -2147,7 +2147,7 @@ void IConsoleGetSetting(const char *name, bool force_newgame)
const SettingDesc *sd = GetSettingFromName(name, &index);
const void *ptr;
- if (sd == NULL) {
+ if (sd == nullptr) {
IConsolePrintF(CC_WARNING, "'%s' is an unknown setting.", name);
return;
}
@@ -2171,7 +2171,7 @@ void IConsoleGetSetting(const char *name, bool force_newgame)
/**
* List all settings and their value to the console
*
- * @param prefilter If not \c NULL, only list settings with names that begin with \a prefilter prefix
+ * @param prefilter If not \c nullptr, only list settings with names that begin with \a prefilter prefix
*/
void IConsoleListSettings(const char *prefilter)
{
@@ -2179,7 +2179,7 @@ void IConsoleListSettings(const char *prefilter)
for (const SettingDesc *sd = _settings; sd->save.cmd != SL_END; sd++) {
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
- if (prefilter != NULL && strstr(sd->desc.name, prefilter) == NULL) continue;
+ if (prefilter != nullptr && strstr(sd->desc.name, prefilter) == nullptr) continue;
char value[80];
const void *ptr = GetVariableAddress(&GetGameSettings(), &sd->save);
@@ -2199,7 +2199,7 @@ void IConsoleListSettings(const char *prefilter)
/**
* Save and load handler for settings
* @param osd SettingDesc struct containing all information
- * @param object can be either NULL in which case we load global variables or
+ * @param object can be either nullptr in which case we load global variables or
* a pointer to a struct which is getting saved
*/
static void LoadSettings(const SettingDesc *osd, void *object)
@@ -2216,7 +2216,7 @@ static void LoadSettings(const SettingDesc *osd, void *object)
/**
* Save and load handler for settings
* @param sd SettingDesc struct containing all information
- * @param object can be either NULL in which case we load global variables or
+ * @param object can be either nullptr in which case we load global variables or
* a pointer to a struct which is getting saved
*/
static void SaveSettings(const SettingDesc *sd, void *object)
@@ -2265,8 +2265,8 @@ static void Save_PATS()
}
extern const ChunkHandler _setting_chunk_handlers[] = {
- { 'OPTS', NULL, Load_OPTS, NULL, NULL, CH_RIFF},
- { 'PATS', Save_PATS, Load_PATS, NULL, Check_PATS, CH_RIFF | CH_LAST},
+ { 'OPTS', nullptr, Load_OPTS, nullptr, nullptr, CH_RIFF},
+ { 'PATS', Save_PATS, Load_PATS, nullptr, Check_PATS, CH_RIFF | CH_LAST},
};
static bool IsSignedVarMemType(VarType vt)