diff options
author | truelight <truelight@openttd.org> | 2007-09-14 22:25:00 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-09-14 22:25:00 +0000 |
commit | 5647bd5157b623348feb202623057fd84eb9c3c5 (patch) | |
tree | 2f8a55c487d1c409dbbfdb98adfc4ab13904ef6f /src/fileio.h | |
parent | b25c661ce6c932c341c1d5055e94a142a34816a9 (diff) | |
download | openttd-5647bd5157b623348feb202623057fd84eb9c3c5.tar.xz |
(svn r11106) -Add: added .tar support; you can pack all files in your data/ dir in how ever many .tar files you like, keeping the dir-structure equal to the unpacked version, and OpenTTD can handle them just like the files were unpacked
-Note: useful for GRF-packs and 32bpp PNGs. Don't forget to keep the dir-structure alive for 32bpp PNGs!
-Note: file-loading-order: search-paths, .tar-files in the order found on disk (can be anything at all, don't depend on it.. use 'openttd -d1' to see which order they are added)
Diffstat (limited to 'src/fileio.h')
-rw-r--r-- | src/fileio.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fileio.h b/src/fileio.h index a5333653b..426226399 100644 --- a/src/fileio.h +++ b/src/fileio.h @@ -6,6 +6,7 @@ #define FILEIO_H #include "helpers.hpp" +#include <list> void FioSeekTo(uint32 pos, int mode); void FioSeekToFile(uint8 slot, uint32 pos); @@ -61,6 +62,11 @@ DECLARE_POSTFIX_INCREMENT(Searchpath); extern const char *_searchpaths[NUM_SEARCHPATHS]; /** + * All the tar-files OpenTTD could search through. + */ +extern std::list<const char *>_tar_list; + +/** * 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 @@ -72,6 +78,10 @@ static inline 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)) +#define FOR_ALL_TARS(tar) for (std::list<const char *>::iterator it = _tar_list.begin(); it != _tar_list.end(); it++) if (tar = *it, true) + +typedef bool FioTarFileListCallback(const char *filename, int size, void *userdata); +FILE *FioTarFileList(const char *tar, const char *mode, size_t *filesize, FioTarFileListCallback *callback, void *userdata); FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = DATA_DIR, size_t *filesize = NULL); bool FioCheckFileExists(const char *filename, Subdirectory subdir = DATA_DIR); |