Codechange: range based for loops instead of C-style for loops

This commit is contained in:
Rubidium
2024-04-09 17:18:35 +02:00
committed by rubidium42
parent 2587a21400
commit 4f2412a272
19 changed files with 65 additions and 66 deletions

View File

@@ -1008,9 +1008,9 @@ void DeterminePaths(const char *exe, bool only_local_path)
};
config_dir.clear();
for (uint i = 0; i < lengthof(new_openttd_cfg_order); i++) {
if (IsValidSearchPath(new_openttd_cfg_order[i])) {
config_dir = _searchpaths[new_openttd_cfg_order[i]];
for (const auto &searchpath : new_openttd_cfg_order) {
if (IsValidSearchPath(searchpath)) {
config_dir = _searchpaths[searchpath];
break;
}
}
@@ -1061,8 +1061,8 @@ void DeterminePaths(const char *exe, bool only_local_path)
SAVE_DIR, AUTOSAVE_DIR, SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR, GAME_DIR, GAME_LIBRARY_DIR, SCREENSHOT_DIR, SOCIAL_INTEGRATION_DIR
};
for (uint i = 0; i < lengthof(default_subdirs); i++) {
FioCreateDirectory(_personal_dir + _subdirs[default_subdirs[i]]);
for (const auto &default_subdir : default_subdirs) {
FioCreateDirectory(_personal_dir + _subdirs[default_subdir]);
}
/* If we have network we make a directory for the autodownloading of content */
@@ -1072,9 +1072,9 @@ void DeterminePaths(const char *exe, bool only_local_path)
FillValidSearchPaths(only_local_path);
/* Create the directory for each of the types of content */
const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR, GAME_DIR, GAME_LIBRARY_DIR, SOCIAL_INTEGRATION_DIR };
for (uint i = 0; i < lengthof(dirs); i++) {
FioCreateDirectory(FioGetDirectory(SP_AUTODOWNLOAD_DIR, dirs[i]));
const Subdirectory subdirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR, GAME_DIR, GAME_LIBRARY_DIR, SOCIAL_INTEGRATION_DIR };
for (const auto &subdir : subdirs) {
FioCreateDirectory(FioGetDirectory(SP_AUTODOWNLOAD_DIR, subdir));
}
extern std::string _log_file;