(svn r13618) -Codechange: move tar-specific declarations to separate file
authorsmatz
Tue, 24 Jun 2008 09:05:24 +0000
changeset 11061 f5806d84e7a9
parent 11060 88faea407e28
child 11062 19abd15f7cf8
(svn r13618) -Codechange: move tar-specific declarations to separate file
Removes indirect dependency on <string> and <map> for over 40 files
projects/openttd_vs80.vcproj
projects/openttd_vs90.vcproj
source.list
src/fileio.cpp
src/fileio.h
src/newgrf_config.cpp
src/settings_gui.cpp
src/tar_type.h
src/town_cmd.cpp
--- a/projects/openttd_vs80.vcproj	Mon Jun 23 22:51:21 2008 +0000
+++ b/projects/openttd_vs80.vcproj	Tue Jun 24 09:05:24 2008 +0000
@@ -1456,6 +1456,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\tar_type.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\terraform_gui.h"
 				>
 			</File>
--- a/projects/openttd_vs90.vcproj	Mon Jun 23 22:51:21 2008 +0000
+++ b/projects/openttd_vs90.vcproj	Tue Jun 24 09:05:24 2008 +0000
@@ -1453,6 +1453,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\tar_type.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\terraform_gui.h"
 				>
 			</File>
--- a/source.list	Mon Jun 23 22:51:21 2008 +0000
+++ b/source.list	Tue Jun 24 09:05:24 2008 +0000
@@ -289,6 +289,7 @@
 string_type.h
 strings_func.h
 strings_type.h
+tar_type.h
 terraform_gui.h
 textbuf_gui.h
 texteff.hpp
--- a/src/fileio.cpp	Mon Jun 23 22:51:21 2008 +0000
+++ b/src/fileio.cpp	Tue Jun 24 09:05:24 2008 +0000
@@ -11,6 +11,7 @@
 #include "core/alloc_func.hpp"
 #include "core/math_func.hpp"
 #include "string_func.h"
+#include "tar_type.h"
 #ifdef WIN32
 #include <windows.h>
 #else
--- a/src/fileio.h	Mon Jun 23 22:51:21 2008 +0000
+++ b/src/fileio.h	Tue Jun 24 09:05:24 2008 +0000
@@ -5,8 +5,6 @@
 #ifndef FILEIO_H
 #define FILEIO_H
 
-#include <map>
-#include <string>
 #include "core/enum_type.hpp"
 
 void FioSeekTo(size_t pos, int mode);
@@ -63,22 +61,6 @@
 extern const char *_searchpaths[NUM_SEARCHPATHS];
 
 /**
- * The define of a TarList.
- */
-struct TarListEntry {
-	const char *filename;
-};
-struct TarFileListEntry {
-	TarListEntry *tar;
-	size_t size;
-	size_t position;
-};
-typedef std::map<std::string, TarListEntry *> TarList;
-typedef std::map<std::string, TarFileListEntry> TarFileList;
-extern TarList _tar_list;
-extern TarFileList _tar_filelist;
-
-/**
  * 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
@@ -90,10 +72,6 @@
 
 /** 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 (tar = _tar_filelist.begin(); tar != _tar_filelist.end(); tar++)
-
-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);
 
 void FioFCloseFile(FILE *f);
 FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = DATA_DIR, size_t *filesize = NULL);
--- a/src/newgrf_config.cpp	Mon Jun 23 22:51:21 2008 +0000
+++ b/src/newgrf_config.cpp	Tue Jun 24 09:05:24 2008 +0000
@@ -15,6 +15,7 @@
 #include "gamelog.h"
 #include "network/network_type.h"
 
+#include "tar_type.h"
 #include "fileio.h"
 #include "fios.h"
 #include <sys/stat.h>
--- a/src/settings_gui.cpp	Mon Jun 23 22:51:21 2008 +0000
+++ b/src/settings_gui.cpp	Tue Jun 24 09:05:24 2008 +0000
@@ -27,6 +27,7 @@
 #include "widgets/dropdown_type.h"
 #include "widgets/dropdown_func.h"
 #include "station_func.h"
+#include <map>
 
 #include "table/sprites.h"
 #include "table/strings.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tar_type.h	Tue Jun 24 09:05:24 2008 +0000
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+#ifndef TAR_TYPE_H
+
+/** @file tar_type.h Structs, typedefs and macros used for TAR file handling. */
+
+#include <map>
+#include <string>
+
+/** The define of a TarList. */
+struct TarListEntry {
+	const char *filename;
+};
+
+struct TarFileListEntry {
+	TarListEntry *tar;
+	size_t size;
+	size_t position;
+};
+
+typedef std::map<std::string, TarListEntry *> TarList;
+typedef std::map<std::string, TarFileListEntry> TarFileList;
+extern TarList _tar_list;
+extern TarFileList _tar_filelist;
+
+#define FOR_ALL_TARS(tar) for (tar = _tar_filelist.begin(); tar != _tar_filelist.end(); tar++)
+
+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);
+
+#endif /* TAR_TYPE_H */
--- a/src/town_cmd.cpp	Mon Jun 23 22:51:21 2008 +0000
+++ b/src/town_cmd.cpp	Tue Jun 24 09:05:24 2008 +0000
@@ -47,6 +47,7 @@
 #include "functions.h"
 #include "animated_tile_func.h"
 #include "date_func.h"
+#include <map>
 
 #include "table/strings.h"
 #include "table/sprites.h"