summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-31 10:50:05 +0000
committerrubidium <rubidium@openttd.org>2008-08-31 10:50:05 +0000
commitea1f180a55f66ae02f95e63d387fa445061daa25 (patch)
treec32cbaf06fe071c31b5540a00a6a0e8317d4f1d4 /src
parent46e23b8f996f0e684d2447c637b10daa5abfb964 (diff)
downloadopenttd-ea1f180a55f66ae02f95e63d387fa445061daa25.tar.xz
(svn r14199) -Codechange: split fileio.h into fileio_type.h and fileio_func.h so not everything that includes saveload.h needs to include everything else too.
Diffstat (limited to 'src')
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/fileio.cpp2
-rw-r--r--src/fileio_func.h (renamed from src/fileio.h)90
-rw-r--r--src/fileio_type.h42
-rw-r--r--src/fios.cpp2
-rw-r--r--src/fios.h47
-rw-r--r--src/gfxinit.cpp2
-rw-r--r--src/ini.cpp2
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/music_gui.cpp2
-rw-r--r--src/network/network.cpp1
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_server.cpp2
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/newgrf_config.cpp2
-rw-r--r--src/openttd.cpp2
-rw-r--r--src/saveload.cpp1
-rw-r--r--src/saveload.h2
-rw-r--r--src/screenshot.cpp3
-rw-r--r--src/sound.cpp2
-rw-r--r--src/spritecache.cpp2
-rw-r--r--src/spriteloader/grf.cpp2
-rw-r--r--src/spriteloader/png.cpp2
-rw-r--r--src/strings.cpp2
-rw-r--r--src/video/dedicated_v.cpp2
25 files changed, 116 insertions, 106 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 2286f865f..c0a7b1c7d 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -15,7 +15,7 @@
#include "command_func.h"
#include "settings_func.h"
#include "fios.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "screenshot.h"
#include "genworld.h"
#include "strings_func.h"
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 9e141c6e5..381d51c57 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -4,7 +4,7 @@
#include "stdafx.h"
#include "openttd.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "variables.h"
#include "debug.h"
#include "fios.h"
diff --git a/src/fileio.h b/src/fileio_func.h
index 7c8a80221..476e1afff 100644
--- a/src/fileio.h
+++ b/src/fileio_func.h
@@ -1,11 +1,11 @@
/* $Id$ */
-/** @file fileio.h Declarations for Standard In/Out file operations */
+/** @file fileio_func.h Functions for Standard In/Out file operations */
-#ifndef FILEIO_H
-#define FILEIO_H
+#ifndef FILEIO_FUNC_H
+#define FILEIO_FUNC_H
-#include "core/enum_type.hpp"
+#include "fileio_type.h"
void FioSeekTo(size_t pos, int mode);
void FioSeekToFile(uint8 slot, size_t pos);
@@ -21,38 +21,6 @@ void FioSkipBytes(int n);
void FioCreateDirectory(const char *filename);
/**
- * The different kinds of subdirectories OpenTTD uses
- */
-enum Subdirectory {
- BASE_DIR, ///< Base directory for all subdirectories
- SAVE_DIR, ///< Base directory for all savegames
- AUTOSAVE_DIR, ///< Subdirectory of save for autosaves
- SCENARIO_DIR, ///< Base directory for all scenarios
- HEIGHTMAP_DIR, ///< Subdirectory of scenario for heightmaps
- GM_DIR, ///< Subdirectory for all music
- DATA_DIR, ///< Subdirectory for all data (GRFs, sample.cat, intro game)
- LANG_DIR, ///< Subdirectory for all translation files
- NUM_SUBDIRS, ///< Number of subdirectories
- NO_DIRECTORY, ///< A path without any base directory
-};
-
-/**
- * Types of searchpaths OpenTTD might use
- */
-enum Searchpath {
- SP_FIRST_DIR,
- SP_WORKING_DIR = SP_FIRST_DIR, ///< Search in the working directory
- SP_PERSONAL_DIR, ///< Search in the personal directory
- SP_SHARED_DIR, ///< Search in the shared directory, like 'Shared Files' under Windows
- SP_BINARY_DIR, ///< Search in the directory where the binary resides
- SP_INSTALLATION_DIR, ///< Search in the installation directory
- SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle
- NUM_SEARCHPATHS
-};
-
-DECLARE_POSTFIX_INCREMENT(Searchpath);
-
-/**
* The searchpaths OpenTTD could search through.
* At least one of the slots has to be filled with a path.
* NULL paths tell that there is no such path for the
@@ -112,4 +80,52 @@ public:
virtual bool AddFile(const char *filename, size_t basepath_length) = 0;
};
-#endif /* FILEIO_H */
+
+/* Implementation of opendir/readdir/closedir for Windows */
+#if defined(WIN32)
+#include <windows.h>
+struct DIR;
+
+struct dirent { // XXX - only d_name implemented
+ TCHAR *d_name; // name of found file
+ /* little hack which will point to parent DIR struct which will
+ * save us a call to GetFileAttributes if we want information
+ * about the file (for example in function fio_bla) */
+ DIR *dir;
+};
+
+struct DIR {
+ HANDLE hFind;
+ /* the dirent returned by readdir.
+ * note: having only one global instance is not possible because
+ * multiple independent opendir/readdir sequences must be supported. */
+ dirent ent;
+ WIN32_FIND_DATA fd;
+ /* since opendir calls FindFirstFile, we need a means of telling the
+ * first call to readdir that we already have a file.
+ * that's the case iff this is true */
+ bool at_first_entry;
+};
+
+DIR *opendir(const TCHAR *path);
+struct dirent *readdir(DIR *d);
+int closedir(DIR *d);
+#else
+/* Use system-supplied opendir/readdir/closedir functions */
+# include <sys/types.h>
+# include <dirent.h>
+#endif /* defined(WIN32) */
+
+/**
+ * A wrapper around opendir() which will convert the string from
+ * OPENTTD encoding to that of the filesystem. For all purposes this
+ * function behaves the same as the original opendir function
+ * @param path string to open directory of
+ * @return DIR pointer
+ */
+static inline DIR *ttd_opendir(const char *path)
+{
+ return opendir(OTTD2FS(path));
+}
+
+#endif /* FILEIO_FUNC_H */
diff --git a/src/fileio_type.h b/src/fileio_type.h
new file mode 100644
index 000000000..baef9c70d
--- /dev/null
+++ b/src/fileio_type.h
@@ -0,0 +1,42 @@
+/* $Id$ */
+
+/** @file fileio_type.h Types for Standard In/Out file operations */
+
+#ifndef FILEIO_TYPE_H
+#define FILEIO_TYPE_H
+
+#include "core/enum_type.hpp"
+
+/**
+ * The different kinds of subdirectories OpenTTD uses
+ */
+enum Subdirectory {
+ BASE_DIR, ///< Base directory for all subdirectories
+ SAVE_DIR, ///< Base directory for all savegames
+ AUTOSAVE_DIR, ///< Subdirectory of save for autosaves
+ SCENARIO_DIR, ///< Base directory for all scenarios
+ HEIGHTMAP_DIR, ///< Subdirectory of scenario for heightmaps
+ GM_DIR, ///< Subdirectory for all music
+ DATA_DIR, ///< Subdirectory for all data (GRFs, sample.cat, intro game)
+ LANG_DIR, ///< Subdirectory for all translation files
+ NUM_SUBDIRS, ///< Number of subdirectories
+ NO_DIRECTORY, ///< A path without any base directory
+};
+
+/**
+ * Types of searchpaths OpenTTD might use
+ */
+enum Searchpath {
+ SP_FIRST_DIR,
+ SP_WORKING_DIR = SP_FIRST_DIR, ///< Search in the working directory
+ SP_PERSONAL_DIR, ///< Search in the personal directory
+ SP_SHARED_DIR, ///< Search in the shared directory, like 'Shared Files' under Windows
+ SP_BINARY_DIR, ///< Search in the directory where the binary resides
+ SP_INSTALLATION_DIR, ///< Search in the installation directory
+ SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle
+ NUM_SEARCHPATHS
+};
+
+DECLARE_POSTFIX_INCREMENT(Searchpath);
+
+#endif /* FILEIO_TYPE_H */
diff --git a/src/fios.cpp b/src/fios.cpp
index cdecb1b34..116179228 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -9,7 +9,7 @@
#include "variables.h"
#include "heightmap.h"
#include "fios.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "functions.h"
#include "string_func.h"
#include <sys/types.h>
diff --git a/src/fios.h b/src/fios.h
index 40982bf4d..d40292be1 100644
--- a/src/fios.h
+++ b/src/fios.h
@@ -110,51 +110,4 @@ FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file,
int CDECL compare_FiosItems(const void *a, const void *b);
-/* Implementation of opendir/readdir/closedir for Windows */
-#if defined(WIN32)
-#include <windows.h>
-struct DIR;
-
-struct dirent { // XXX - only d_name implemented
- TCHAR *d_name; // name of found file
- /* little hack which will point to parent DIR struct which will
- * save us a call to GetFileAttributes if we want information
- * about the file (for example in function fio_bla) */
- DIR *dir;
-};
-
-struct DIR {
- HANDLE hFind;
- /* the dirent returned by readdir.
- * note: having only one global instance is not possible because
- * multiple independent opendir/readdir sequences must be supported. */
- dirent ent;
- WIN32_FIND_DATA fd;
- /* since opendir calls FindFirstFile, we need a means of telling the
- * first call to readdir that we already have a file.
- * that's the case iff this is true */
- bool at_first_entry;
-};
-
-DIR *opendir(const TCHAR *path);
-struct dirent *readdir(DIR *d);
-int closedir(DIR *d);
-#else
-/* Use system-supplied opendir/readdir/closedir functions */
-# include <sys/types.h>
-# include <dirent.h>
-#endif /* defined(WIN32) */
-
-/**
- * A wrapper around opendir() which will convert the string from
- * OPENTTD encoding to that of the filesystem. For all purposes this
- * function behaves the same as the original opendir function
- * @param path string to open directory of
- * @return DIR pointer
- */
-static inline DIR *ttd_opendir(const char *path)
-{
- return opendir(OTTD2FS(path));
-}
-
#endif /* FIOS_H */
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index c6497bb0b..f76e90968 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -7,7 +7,7 @@
#include "debug.h"
#include "gfxinit.h"
#include "spritecache.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "fios.h"
#include "newgrf.h"
#include "md5.h"
diff --git a/src/ini.cpp b/src/ini.cpp
index 7c1786a74..defc913c9 100644
--- a/src/ini.cpp
+++ b/src/ini.cpp
@@ -8,7 +8,7 @@
#include "debug.h"
#include "ini_type.h"
#include "string_func.h"
-#include "fileio.h"
+#include "fileio_func.h"
IniItem::IniItem(IniGroup *parent, const char *name, size_t len) : next(NULL), value(NULL), comment(NULL)
{
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 6c7221ac4..25f8e3baf 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -30,7 +30,7 @@
#include "cargotype.h"
#include "player_face.h"
#include "strings_func.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "fios.h"
#include "tile_cmd.h"
#include "zoom_func.h"
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index aa2a8f97d..002fb5070 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -4,7 +4,7 @@
#include "stdafx.h"
#include "openttd.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "variables.h"
#include "music.h"
#include "music/music_driver.hpp"
diff --git a/src/network/network.cpp b/src/network/network.cpp
index dff8c220d..e2b355c6f 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -28,7 +28,6 @@
#include "../console_func.h"
#include <stdarg.h> /* va_list */
#include "../md5.h"
-#include "../fileio.h"
#include "../texteff.hpp"
#include "../core/random_func.hpp"
#include "../window_func.h"
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 4814973a1..0b07e7da0 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -18,7 +18,7 @@
#include "../variables.h"
#include "../ai/ai.h"
#include "../core/alloc_func.hpp"
-#include "../fileio.h"
+#include "../fileio_func.h"
#include "../md5.h"
#include "../strings_func.h"
#include "../window_func.h"
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 56f8b724e..d1e1614f6 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -22,7 +22,7 @@
#include "../variables.h"
#include "../genworld.h"
#include "../core/alloc_func.hpp"
-#include "../fileio.h"
+#include "../fileio_func.h"
#include "../string_func.h"
#include "../player_base.h"
#include "../player_func.h"
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 1f8756d0a..fadb9f57d 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -8,7 +8,7 @@
#include "openttd.h"
#include "debug.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "engine_func.h"
#include "engine_base.h"
#include "spritecache.h"
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 6faeb8d77..98ba8d420 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -15,7 +15,7 @@
#include "gamelog.h"
#include "network/network_type.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "fios.h"
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 61f466056..73589937c 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -33,7 +33,7 @@
#include "town.h"
#include "industry.h"
#include "news_func.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "fios.h"
#include "airport.h"
#include "aircraft.h"
diff --git a/src/saveload.cpp b/src/saveload.cpp
index a05302a1c..180d80ece 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -31,6 +31,7 @@
#include "vehicle_base.h"
#include "autoreplace_base.h"
#include "statusbar_gui.h"
+#include "fileio_func.h"
#include <list>
#include "gamelog.h"
diff --git a/src/saveload.h b/src/saveload.h
index dfe07350c..df2dc9f07 100644
--- a/src/saveload.h
+++ b/src/saveload.h
@@ -5,7 +5,7 @@
#ifndef SAVELOAD_H
#define SAVELOAD_H
-#include "fileio.h"
+#include "fileio_type.h"
#ifdef SIZE_MAX
#undef SIZE_MAX
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 6f5cc0105..5a9ef0581 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -5,14 +5,13 @@
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "core/math_func.hpp"
#include "screenshot.h"
#include "variables.h"
#include "blitter/factory.hpp"
-#include "fileio.h"
#include "strings_func.h"
#include "zoom_func.h"
#include "core/alloc_func.hpp"
diff --git a/src/sound.cpp b/src/sound.cpp
index ab5872b12..81c22cbb4 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -7,7 +7,7 @@
#include "landscape.h"
#include "mixer.h"
#include "sound_func.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "newgrf_sound.h"
#include "fios.h"
#include "window_gui.h"
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index d9c2498a8..616eb59b1 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -7,7 +7,7 @@
#include "variables.h"
#include "debug.h"
#include "spritecache.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "spriteloader/grf.hpp"
#include "core/alloc_func.hpp"
#include "core/math_func.hpp"
diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp
index 0bd73f927..871a9fa0a 100644
--- a/src/spriteloader/grf.cpp
+++ b/src/spriteloader/grf.cpp
@@ -4,7 +4,7 @@
#include "../stdafx.h"
#include "../gfx_func.h"
-#include "../fileio.h"
+#include "../fileio_func.h"
#include "../debug.h"
#include "../core/alloc_func.hpp"
#include "grf.hpp"
diff --git a/src/spriteloader/png.cpp b/src/spriteloader/png.cpp
index 54d04a3a8..4ccc502aa 100644
--- a/src/spriteloader/png.cpp
+++ b/src/spriteloader/png.cpp
@@ -6,7 +6,7 @@
#include "../stdafx.h"
#include "../gfx_func.h"
-#include "../fileio.h"
+#include "../fileio_func.h"
#include "../debug.h"
#include "../core/alloc_func.hpp"
#include "png.hpp"
diff --git a/src/strings.cpp b/src/strings.cpp
index ac02b5178..f644eb795 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -15,7 +15,7 @@
#include "newgrf_text.h"
#include "music.h"
#include "industry.h"
-#include "fileio.h"
+#include "fileio_func.h"
#include "cargotype.h"
#include "group.h"
#include "debug.h"
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index c54f3d826..08fd87d28 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -14,7 +14,7 @@
#include "../console_func.h"
#include "../variables.h"
#include "../genworld.h"
-#include "../fileio.h"
+#include "../fileio_type.h"
#include "../fios.h"
#include "../blitter/factory.hpp"
#include "../core/alloc_func.hpp"