mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-05 22:04:57 +00:00
(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.
This commit is contained in:
parent
46e23b8f99
commit
ea1f180a55
@ -992,7 +992,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fileio.h"
|
||||
RelativePath=".\..\src\fileio_func.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fileio_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -989,7 +989,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fileio.h"
|
||||
RelativePath=".\..\src\fileio_func.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fileio_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -175,7 +175,8 @@ engine_func.h
|
||||
engine_gui.h
|
||||
engine_type.h
|
||||
fiber.hpp
|
||||
fileio.h
|
||||
fileio_func.h
|
||||
fileio_type.h
|
||||
fios.h
|
||||
fontcache.h
|
||||
functions.h
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
@ -20,38 +20,6 @@ void FioReadBlock(void *ptr, size_t size);
|
||||
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.
|
||||
@ -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 */
|
42
src/fileio_type.h
Normal file
42
src/fileio_type.h
Normal file
@ -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 */
|
@ -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>
|
||||
|
47
src/fios.h
47
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 */
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "gamelog.h"
|
||||
#include "network/network_type.h"
|
||||
|
||||
#include "fileio.h"
|
||||
#include "fileio_func.h"
|
||||
#include "fios.h"
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef SAVELOAD_H
|
||||
#define SAVELOAD_H
|
||||
|
||||
#include "fileio.h"
|
||||
#include "fileio_type.h"
|
||||
|
||||
#ifdef SIZE_MAX
|
||||
#undef SIZE_MAX
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user