summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-06-24 09:05:24 +0000
committersmatz <smatz@openttd.org>2008-06-24 09:05:24 +0000
commitfee2adb299270756d44e2a4f55a3b45b0935c4c7 (patch)
treeece27358f21a7245659bc3c86c57992b89d98699
parent6e1dd7f719e86171f789c4f9fa0102db6f12bfca (diff)
downloadopenttd-fee2adb299270756d44e2a4f55a3b45b0935c4c7.tar.xz
(svn r13618) -Codechange: move tar-specific declarations to separate file
Removes indirect dependency on <string> and <map> for over 40 files
-rw-r--r--projects/openttd_vs80.vcproj4
-rw-r--r--projects/openttd_vs90.vcproj4
-rw-r--r--source.list1
-rw-r--r--src/fileio.cpp1
-rw-r--r--src/fileio.h22
-rw-r--r--src/newgrf_config.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/tar_type.h31
-rw-r--r--src/town_cmd.cpp1
9 files changed, 44 insertions, 22 deletions
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index c8864211a..2d4f9c02e 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -1456,6 +1456,10 @@
>
</File>
<File
+ RelativePath=".\..\src\tar_type.h"
+ >
+ </File>
+ <File
RelativePath=".\..\src\terraform_gui.h"
>
</File>
diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj
index 47407825e..4b33a7f35 100644
--- a/projects/openttd_vs90.vcproj
+++ b/projects/openttd_vs90.vcproj
@@ -1453,6 +1453,10 @@
>
</File>
<File
+ RelativePath=".\..\src\tar_type.h"
+ >
+ </File>
+ <File
RelativePath=".\..\src\terraform_gui.h"
>
</File>
diff --git a/source.list b/source.list
index 9054647b5..8624afe24 100644
--- a/source.list
+++ b/source.list
@@ -289,6 +289,7 @@ string_func.h
string_type.h
strings_func.h
strings_type.h
+tar_type.h
terraform_gui.h
textbuf_gui.h
texteff.hpp
diff --git a/src/fileio.cpp b/src/fileio.cpp
index f68f6693e..56528469a 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -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
diff --git a/src/fileio.h b/src/fileio.h
index c361f849a..6d4aed2b4 100644
--- a/src/fileio.h
+++ b/src/fileio.h
@@ -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 @@ DECLARE_POSTFIX_INCREMENT(Searchpath);
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 @@ 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 (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);
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 0a09c82f4..312472bd1 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -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>
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index f22ca3609..5ffa1f436 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -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"
diff --git a/src/tar_type.h b/src/tar_type.h
new file mode 100644
index 000000000..d032a0809
--- /dev/null
+++ b/src/tar_type.h
@@ -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 */
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index f0747c0fd..2b79adfc8 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -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"