diff options
author | truelight <truelight@openttd.org> | 2007-09-16 18:10:52 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-09-16 18:10:52 +0000 |
commit | 631dc06212b279edf696698cbe425bb8a2980ac0 (patch) | |
tree | e90824fc3128a0ec0f50cddb2f481db5dfd08158 /src/newgrf_config.cpp | |
parent | 345a4a28d89760eb42851ffcab63a06b5a114610 (diff) | |
download | openttd-631dc06212b279edf696698cbe425bb8a2980ac0.tar.xz |
(svn r11119) -Codechange: analyze .tar files upon loading, remembering their files and offsets, which speeds up .tar handling with a big factor
-Fix: several win32 .tar support problems
-Fix: better checking of .tar versions and other minor things
-Codechange: don't call fclose() but FioFClose to close a file
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r-- | src/newgrf_config.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 0db3c67aa..2642a93ba 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -51,7 +51,7 @@ static bool CalcGRFMD5Sum(GRFConfig *config) } md5_finish(&md5state, config->md5sum); - fclose(f); + FioFCloseFile(f); return true; } @@ -356,26 +356,18 @@ static uint ScanPath(const char *path, int basepath_length) return num; } -bool FioTarFileListScanNewGRFCallback(const char *filename, int size, void *userdata) +static uint ScanTar(TarFileList::iterator tar) { - uint *num = (uint *)userdata; + uint num = 0; + const char *filename = (*tar).first.c_str(); const char *ext = strrchr(filename, '.'); /* If no extension or extension isn't .grf, skip the file */ if (ext == NULL) return false; if (strcasecmp(ext, ".grf") != 0) return false; - if (ScanPathAddGrf(filename)) (*num)++; - - /* Always return false, as we don't want to stop with listing all the files */ - return false; -} - -static uint ScanTar(const char *filename) -{ - uint num = 0; + if (ScanPathAddGrf(filename)) num++; - FioTarFileList(filename, "rb", NULL, FioTarFileListScanNewGRFCallback, &num); return num; } @@ -384,7 +376,7 @@ void ScanNewGRFFiles() { Searchpath sp; char path[MAX_PATH]; - const char *tar; + TarFileList::iterator tar; uint num = 0; ClearGRFConfigList(&_all_grfs); |