# tar_type.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef TAR_TYPE_H
    00013 #define TAR_TYPE_H
    00014
    00015 #include <map>
    00016 #include <string>
    00017
    00018 #include "fileio_type.h"
    00019
    00021 struct TarListEntry {
    00022   const char *filename;
    00023   const char *dirname;
    00024
    00025   /* MSVC goes copying around this struct after initialisation, so it tries
    00026    * to free filename, which isn't set at that moment... but because it
    00027    * initializes the variable with garbage, it's going to segfault. */
    00028   TarListEntry() : filename(NULL), dirname(NULL) {}
    00029   ~TarListEntry() { free(this->filename); free(this->dirname); }
    00030 };
    00031
    00032 struct TarFileListEntry {
    00033   const char *tar_filename;
    00034   size_t size;
    00035   size_t position;
    00036 };
    00037
    00038 typedef std::map<std::string, TarListEntry> TarList;
    00039 typedef std::map<std::string, TarFileListEntry> TarFileList;
    00040 extern TarList _tar_list[NUM_SUBDIRS];
    00041 extern TarFileList _tar_filelist[NUM_SUBDIRS];
    00042
    00043 #define FOR_ALL_TARS(tar, sd) for (tar = _tar_filelist[sd].begin(); tar != _tar_filelist[sd].end(); tar++)
    00044
    00045 #endif /* TAR_TYPE_H */