summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-09 09:27:48 +0000
committerrubidium <rubidium@openttd.org>2009-11-09 09:27:48 +0000
commit37027467567dd0b75bbb932cdab87da3ff24dedd (patch)
tree2841920ca76366612d11f5d1c443f52ae440fffd
parent6db598e408f069a78714631868a7b4afd4782605 (diff)
downloadopenttd-37027467567dd0b75bbb932cdab87da3ff24dedd.tar.xz
(svn r18026) -Codechange: make a lookup table static that doesn't need to be 'exported'
-rw-r--r--src/fileio.cpp6
-rw-r--r--src/fileio_func.h7
2 files changed, 3 insertions, 10 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index f8f4d0d70..45d88b82c 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -212,7 +212,7 @@ void FioOpenFile(int slot, const char *filename)
FioSeekToFile(slot, pos);
}
-const char *_subdirs[NUM_SUBDIRS] = {
+static const char *_subdirs[NUM_SUBDIRS] = {
"",
"save" PATHSEP,
"save" PATHSEP "autosave" PATHSEP,
@@ -957,7 +957,7 @@ void DeterminePaths(const char *exe)
};
for (uint i = 0; i < lengthof(default_subdirs); i++) {
- char *dir = str_fmt("%s%s", _personal_dir, FioGetSubdirectory(default_subdirs[i]));
+ char *dir = str_fmt("%s%s", _personal_dir, _subdirs[default_subdirs[i]]);
FioCreateDirectory(dir);
free(dir);
}
@@ -970,7 +970,7 @@ void DeterminePaths(const char *exe)
/* Create the directory for each of the types of content */
const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, DATA_DIR, AI_DIR, AI_LIBRARY_DIR };
for (uint i = 0; i < lengthof(dirs); i++) {
- char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], FioGetSubdirectory(dirs[i]));
+ char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], _subdirs[dirs[i]]);
FioCreateDirectory(tmp);
free(tmp);
}
diff --git a/src/fileio_func.h b/src/fileio_func.h
index 2bb0ecc05..b2d2da803 100644
--- a/src/fileio_func.h
+++ b/src/fileio_func.h
@@ -56,13 +56,6 @@ char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char
char *FioAppendDirectory(char *buf, size_t buflen, Searchpath sp, Subdirectory subdir);
char *FioGetDirectory(char *buf, size_t buflen, Subdirectory subdir);
-static inline const char *FioGetSubdirectory(Subdirectory subdir)
-{
- extern const char *_subdirs[NUM_SUBDIRS];
- assert(subdir < NUM_SUBDIRS);
- return _subdirs[subdir];
-}
-
void SanitizeFilename(char *filename);
void AppendPathSeparator(char *buf, size_t buflen);
void DeterminePaths(const char *exe);