Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops

This commit is contained in:
glx22
2021-04-30 15:41:58 +02:00
committed by Loïc Guilloux
parent 34215f7faa
commit 983c7ade60
5 changed files with 22 additions and 29 deletions

View File

@@ -13,6 +13,7 @@
#include "core/enum_type.hpp"
#include "fileio_type.h"
#include <string>
#include <vector>
void FioSeekTo(size_t pos, int mode);
void FioSeekToFile(uint8 slot, size_t pos);
@@ -26,16 +27,6 @@ void FioOpenFile(int slot, const std::string &filename, Subdirectory subdir);
void FioReadBlock(void *ptr, size_t size);
void FioSkipBytes(int n);
/**
* Checks whether the given search path is a valid search path
* @param sp the search path to check
* @return true if the search path is valid
*/
bool IsValidSearchPath(Searchpath sp);
/** Iterator for all the search paths */
#define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp))
void FioFCloseFile(FILE *f);
FILE *FioFOpenFile(const std::string &filename, const char *mode, Subdirectory subdir, size_t *filesize = nullptr);
bool FioCheckFileExists(const std::string &filename, Subdirectory subdir);
@@ -54,6 +45,7 @@ bool FileExists(const std::string &filename);
bool ExtractTar(const std::string &tar_filename, Subdirectory subdir);
extern std::string _personal_dir; ///< custom directory for personal settings, saves, newgrf, etc.
extern std::vector<Searchpath> _valid_searchpaths;
/** Helper for scanning for files with a given name */
class FileScanner {