src/fileio.h
changeset 7584 8f066de3f874
parent 7581 24dab79dca15
child 7592 792daecf7c77
equal deleted inserted replaced
7583:4896ec945d21 7584:8f066de3f874
     4 
     4 
     5 #ifndef FILEIO_H
     5 #ifndef FILEIO_H
     6 #define FILEIO_H
     6 #define FILEIO_H
     7 
     7 
     8 #include "helpers.hpp"
     8 #include "helpers.hpp"
     9 #include <list>
     9 #include <vector>
    10 
    10 
    11 void FioSeekTo(uint32 pos, int mode);
    11 void FioSeekTo(uint32 pos, int mode);
    12 void FioSeekToFile(uint8 slot, uint32 pos);
    12 void FioSeekToFile(uint8 slot, uint32 pos);
    13 uint32 FioGetPos();
    13 uint32 FioGetPos();
    14 const char *FioGetFilename();
    14 const char *FioGetFilename();
    62 extern const char *_searchpaths[NUM_SEARCHPATHS];
    62 extern const char *_searchpaths[NUM_SEARCHPATHS];
    63 
    63 
    64 /**
    64 /**
    65  * All the tar-files OpenTTD could search through.
    65  * All the tar-files OpenTTD could search through.
    66  */
    66  */
    67 extern std::list<const char *>_tar_list;
    67 extern std::vector<const char *>_tar_list;
    68 
    68 
    69 /**
    69 /**
    70  * Checks whether the given search path is a valid search path
    70  * Checks whether the given search path is a valid search path
    71  * @param sp the search path to check
    71  * @param sp the search path to check
    72  * @return true if the search path is valid
    72  * @return true if the search path is valid
    76 	return sp < NUM_SEARCHPATHS && _searchpaths[sp] != NULL;
    76 	return sp < NUM_SEARCHPATHS && _searchpaths[sp] != NULL;
    77 }
    77 }
    78 
    78 
    79 /** Iterator for all the search paths */
    79 /** Iterator for all the search paths */
    80 #define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp))
    80 #define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp))
    81 #define FOR_ALL_TARS(tar) for (std::list<const char *>::iterator it = _tar_list.begin(); it != _tar_list.end(); it++) if (tar = *it, true)
    81 #define FOR_ALL_TARS(tar) for (std::vector<const char *>::iterator it = _tar_list.begin(); it != _tar_list.end(); it++) if (tar = *it, true)
    82 
    82 
    83 typedef bool FioTarFileListCallback(const char *filename, int size, void *userdata);
    83 typedef bool FioTarFileListCallback(const char *filename, int size, void *userdata);
    84 FILE *FioTarFileList(const char *tar, const char *mode, size_t *filesize, FioTarFileListCallback *callback, void *userdata);
    84 FILE *FioTarFileList(const char *tar, const char *mode, size_t *filesize, FioTarFileListCallback *callback, void *userdata);
    85 
    85 
    86 FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = DATA_DIR, size_t *filesize = NULL);
    86 FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = DATA_DIR, size_t *filesize = NULL);