summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-14 21:34:27 +0000
committerrubidium <rubidium@openttd.org>2011-11-14 21:34:27 +0000
commit2b897b4fa0dd22334ba21a96ca7df5960b2c3355 (patch)
tree9574e5285750ecad60b076cb8d0cca35b631129e /src
parent9e7174e5406cf59a7f0ae79c6dc280b1958ef95d (diff)
downloadopenttd-2b897b4fa0dd22334ba21a96ca7df5960b2c3355.tar.xz
(svn r23219) -Change: different directories for basesets and newgrfs. So data to baseset or newgrf, and gm to baseset
Diffstat (limited to 'src')
-rw-r--r--src/base_media_base.h5
-rw-r--r--src/base_media_func.h4
-rw-r--r--src/fileio.cpp25
-rw-r--r--src/fileio_type.h3
-rw-r--r--src/music_gui.cpp4
-rw-r--r--src/network/network_content.cpp4
6 files changed, 31 insertions, 14 deletions
diff --git a/src/base_media_base.h b/src/base_media_base.h
index 2cdedd672..60647ef98 100644
--- a/src/base_media_base.h
+++ b/src/base_media_base.h
@@ -164,8 +164,9 @@ public:
static uint FindSets()
{
BaseMedia<Tbase_set> fs;
- /* Searching in tars is only done in the sound and graphics base sets. */
- return fs.Scan(GetExtension(), Tbase_set::SEARCH_IN_TARS ? BASESET_DIR : GM_DIR, Tbase_set::SEARCH_IN_TARS);
+ /* Searching in tars is only done in the old "data" directories basesets. */
+ uint num = fs.Scan(GetExtension(), Tbase_set::SEARCH_IN_TARS ? OLD_DATA_DIR : OLD_GM_DIR, Tbase_set::SEARCH_IN_TARS);
+ return num + fs.Scan(GetExtension(), BASESET_DIR, Tbase_set::SEARCH_IN_TARS);
}
static bool SetSet(const char *name);
diff --git a/src/base_media_func.h b/src/base_media_func.h
index c5b07fb4c..1070ead61 100644
--- a/src/base_media_func.h
+++ b/src/base_media_func.h
@@ -131,7 +131,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
file->missing_warning = strdup(item->value);
}
- switch (file->CheckMD5(Tsearch_in_tars ? BASESET_DIR : GM_DIR)) {
+ switch (file->CheckMD5(BASESET_DIR)) {
case MD5File::CR_MATCH:
this->valid_files++;
/* FALL THROUGH */
@@ -155,7 +155,7 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length,
Tbase_set *set = new Tbase_set();
IniFile *ini = new IniFile();
- ini->LoadFromDisk(filename, Tbase_set::SEARCH_IN_TARS ? BASESET_DIR : GM_DIR);
+ ini->LoadFromDisk(filename, BASESET_DIR);
char *path = strdup(filename + basepath_length);
char *psep = strrchr(path, PATHSEPCHAR);
diff --git a/src/fileio.cpp b/src/fileio.cpp
index e3bbb45eb..9b54cb1cb 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -276,7 +276,8 @@ static const char * const _subdirs[] = {
"scenario" PATHSEP "heightmap" PATHSEP,
"gm" PATHSEP,
"data" PATHSEP,
- "data" PATHSEP,
+ "baseset" PATHSEP,
+ "newgrf" PATHSEP,
"lang" PATHSEP,
"ai" PATHSEP,
"ai" PATHSEP "library" PATHSEP,
@@ -501,7 +502,17 @@ FILE *FioFOpenFile(const char *filename, const char *mode, Subdirectory subdir,
/* Sometimes a full path is given. To support
* the 'subdirectory' must be 'removed'. */
if (f == NULL && subdir != NO_DIRECTORY) {
- f = FioFOpenFile(filename, mode, NO_DIRECTORY, filesize);
+ switch (subdir) {
+ case BASESET_DIR:
+ f = FioFOpenFile(filename, mode, OLD_GM_DIR, filesize);
+ case NEWGRF_DIR:
+ f = FioFOpenFile(filename, mode, OLD_DATA_DIR, filesize);
+ break;
+
+ default:
+ f = FioFOpenFile(filename, mode, NO_DIRECTORY, filesize);
+ break;
+ }
}
return f;
@@ -642,7 +653,9 @@ uint TarScanner::DoScan(Subdirectory sd)
{
_tar_filelist[sd].clear();
_tar_list[sd].clear();
- return this->Scan(".tar", sd, false);
+ uint num = this->Scan(".tar", sd, false);
+ if (sd == BASESET_DIR || sd == NEWGRF_DIR) num += this->Scan(".tar", OLD_DATA_DIR, false);
+ return num;
}
/* static */ uint TarScanner::DoScan(TarScanner::Mode mode)
@@ -650,8 +663,10 @@ uint TarScanner::DoScan(Subdirectory sd)
DEBUG(misc, 1, "Scanning for tars");
TarScanner fs;
uint num = 0;
- if (mode & (TarScanner::BASESET | TarScanner::NEWGRF)) {
+ if (mode & TarScanner::BASESET) {
num += fs.DoScan(BASESET_DIR);
+ }
+ if (mode & TarScanner::NEWGRF) {
num += fs.DoScan(NEWGRF_DIR);
}
if (mode & TarScanner::AI) {
@@ -1181,7 +1196,7 @@ void DeterminePaths(const char *exe)
FioCreateDirectory(_searchpaths[SP_AUTODOWNLOAD_DIR]);
/* Create the directory for each of the types of content */
- const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR, GM_DIR };
+ const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR };
for (uint i = 0; i < lengthof(dirs); i++) {
char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], _subdirs[dirs[i]]);
FioCreateDirectory(tmp);
diff --git a/src/fileio_type.h b/src/fileio_type.h
index 355ff36d1..0673bfc6d 100644
--- a/src/fileio_type.h
+++ b/src/fileio_type.h
@@ -23,7 +23,8 @@ enum Subdirectory {
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
+ OLD_GM_DIR, ///< Old subdirectory for the music
+ OLD_DATA_DIR, ///< Old subdirectory for the data.
BASESET_DIR, ///< Subdirectory for all base data (base sets, intro game)
NEWGRF_DIR, ///< Subdirectory for all NewGRFs
LANG_DIR, ///< Subdirectory for all translation files
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 5d0f2534b..2c9d474f8 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -178,7 +178,7 @@ static void MusicVolumeChanged(byte new_vol)
static void DoPlaySong()
{
char filename[MAX_PATH];
- FioFindFullPath(filename, lengthof(filename), GM_DIR,
+ FioFindFullPath(filename, lengthof(filename), BASESET_DIR,
BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
_music_driver->PlaySong(filename);
SetWindowDirty(WC_MUSIC_WINDOW, 0);
@@ -200,7 +200,7 @@ static void SelectSongToPlay()
const char *filename = BaseMusic::GetUsedSet()->files[_playlists[_settings_client.music.playlist][i] - 1].filename;
/* We are now checking for the existence of that file prior
* to add it to the list of available songs */
- if (!StrEmpty(filename) && FioCheckFileExists(filename, GM_DIR)) {
+ if (!StrEmpty(filename) && FioCheckFileExists(filename, BASESET_DIR)) {
_cur_playlist[j] = _playlists[_settings_client.music.playlist][i];
j++;
}
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index d327b71d0..40bf03f97 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -376,7 +376,7 @@ static char *GetFullFilename(const ContentInfo *ci, bool compressed)
switch (ci->type) {
default: return NULL;
case CONTENT_TYPE_BASE_GRAPHICS: dir = BASESET_DIR; break;
- case CONTENT_TYPE_BASE_MUSIC: dir = GM_DIR; break;
+ case CONTENT_TYPE_BASE_MUSIC: dir = BASESET_DIR; break;
case CONTENT_TYPE_BASE_SOUNDS: dir = BASESET_DIR; break;
case CONTENT_TYPE_NEWGRF: dir = NEWGRF_DIR; break;
case CONTENT_TYPE_AI: dir = AI_DIR; break;
@@ -535,7 +535,7 @@ void ClientNetworkContentSocketHandler::AfterDownload()
if (this->curInfo->type == CONTENT_TYPE_BASE_MUSIC) {
/* Music can't be in a tar. So extract the tar! */
- ExtractTar(GetFullFilename(this->curInfo, false), GM_DIR);
+ ExtractTar(GetFullFilename(this->curInfo, false), BASESET_DIR);
unlink(GetFullFilename(this->curInfo, false));
}