mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r23219) -Change: different directories for basesets and newgrfs. So data to baseset or newgrf, and gm to baseset
This commit is contained in:
parent
9e7174e540
commit
2b897b4fa0
|
@ -164,8 +164,9 @@ public:
|
||||||
static uint FindSets()
|
static uint FindSets()
|
||||||
{
|
{
|
||||||
BaseMedia<Tbase_set> fs;
|
BaseMedia<Tbase_set> fs;
|
||||||
/* Searching in tars is only done in the sound and graphics base sets. */
|
/* Searching in tars is only done in the old "data" directories basesets. */
|
||||||
return fs.Scan(GetExtension(), Tbase_set::SEARCH_IN_TARS ? BASESET_DIR : GM_DIR, Tbase_set::SEARCH_IN_TARS);
|
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);
|
static bool SetSet(const char *name);
|
||||||
|
|
|
@ -131,7 +131,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
|
||||||
file->missing_warning = strdup(item->value);
|
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:
|
case MD5File::CR_MATCH:
|
||||||
this->valid_files++;
|
this->valid_files++;
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
|
@ -155,7 +155,7 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length,
|
||||||
|
|
||||||
Tbase_set *set = new Tbase_set();
|
Tbase_set *set = new Tbase_set();
|
||||||
IniFile *ini = new IniFile();
|
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 *path = strdup(filename + basepath_length);
|
||||||
char *psep = strrchr(path, PATHSEPCHAR);
|
char *psep = strrchr(path, PATHSEPCHAR);
|
||||||
|
|
|
@ -276,7 +276,8 @@ static const char * const _subdirs[] = {
|
||||||
"scenario" PATHSEP "heightmap" PATHSEP,
|
"scenario" PATHSEP "heightmap" PATHSEP,
|
||||||
"gm" PATHSEP,
|
"gm" PATHSEP,
|
||||||
"data" PATHSEP,
|
"data" PATHSEP,
|
||||||
"data" PATHSEP,
|
"baseset" PATHSEP,
|
||||||
|
"newgrf" PATHSEP,
|
||||||
"lang" PATHSEP,
|
"lang" PATHSEP,
|
||||||
"ai" PATHSEP,
|
"ai" PATHSEP,
|
||||||
"ai" PATHSEP "library" 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
|
/* Sometimes a full path is given. To support
|
||||||
* the 'subdirectory' must be 'removed'. */
|
* the 'subdirectory' must be 'removed'. */
|
||||||
if (f == NULL && subdir != NO_DIRECTORY) {
|
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;
|
return f;
|
||||||
|
@ -642,7 +653,9 @@ uint TarScanner::DoScan(Subdirectory sd)
|
||||||
{
|
{
|
||||||
_tar_filelist[sd].clear();
|
_tar_filelist[sd].clear();
|
||||||
_tar_list[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)
|
/* static */ uint TarScanner::DoScan(TarScanner::Mode mode)
|
||||||
|
@ -650,8 +663,10 @@ uint TarScanner::DoScan(Subdirectory sd)
|
||||||
DEBUG(misc, 1, "Scanning for tars");
|
DEBUG(misc, 1, "Scanning for tars");
|
||||||
TarScanner fs;
|
TarScanner fs;
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
if (mode & (TarScanner::BASESET | TarScanner::NEWGRF)) {
|
if (mode & TarScanner::BASESET) {
|
||||||
num += fs.DoScan(BASESET_DIR);
|
num += fs.DoScan(BASESET_DIR);
|
||||||
|
}
|
||||||
|
if (mode & TarScanner::NEWGRF) {
|
||||||
num += fs.DoScan(NEWGRF_DIR);
|
num += fs.DoScan(NEWGRF_DIR);
|
||||||
}
|
}
|
||||||
if (mode & TarScanner::AI) {
|
if (mode & TarScanner::AI) {
|
||||||
|
@ -1181,7 +1196,7 @@ void DeterminePaths(const char *exe)
|
||||||
FioCreateDirectory(_searchpaths[SP_AUTODOWNLOAD_DIR]);
|
FioCreateDirectory(_searchpaths[SP_AUTODOWNLOAD_DIR]);
|
||||||
|
|
||||||
/* Create the directory for each of the types of content */
|
/* 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++) {
|
for (uint i = 0; i < lengthof(dirs); i++) {
|
||||||
char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], _subdirs[dirs[i]]);
|
char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], _subdirs[dirs[i]]);
|
||||||
FioCreateDirectory(tmp);
|
FioCreateDirectory(tmp);
|
||||||
|
|
|
@ -23,7 +23,8 @@ enum Subdirectory {
|
||||||
AUTOSAVE_DIR, ///< Subdirectory of save for autosaves
|
AUTOSAVE_DIR, ///< Subdirectory of save for autosaves
|
||||||
SCENARIO_DIR, ///< Base directory for all scenarios
|
SCENARIO_DIR, ///< Base directory for all scenarios
|
||||||
HEIGHTMAP_DIR, ///< Subdirectory of scenario for heightmaps
|
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)
|
BASESET_DIR, ///< Subdirectory for all base data (base sets, intro game)
|
||||||
NEWGRF_DIR, ///< Subdirectory for all NewGRFs
|
NEWGRF_DIR, ///< Subdirectory for all NewGRFs
|
||||||
LANG_DIR, ///< Subdirectory for all translation files
|
LANG_DIR, ///< Subdirectory for all translation files
|
||||||
|
|
|
@ -178,7 +178,7 @@ static void MusicVolumeChanged(byte new_vol)
|
||||||
static void DoPlaySong()
|
static void DoPlaySong()
|
||||||
{
|
{
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
FioFindFullPath(filename, lengthof(filename), GM_DIR,
|
FioFindFullPath(filename, lengthof(filename), BASESET_DIR,
|
||||||
BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
|
BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
|
||||||
_music_driver->PlaySong(filename);
|
_music_driver->PlaySong(filename);
|
||||||
SetWindowDirty(WC_MUSIC_WINDOW, 0);
|
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;
|
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
|
/* We are now checking for the existence of that file prior
|
||||||
* to add it to the list of available songs */
|
* 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];
|
_cur_playlist[j] = _playlists[_settings_client.music.playlist][i];
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,7 +376,7 @@ static char *GetFullFilename(const ContentInfo *ci, bool compressed)
|
||||||
switch (ci->type) {
|
switch (ci->type) {
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
case CONTENT_TYPE_BASE_GRAPHICS: dir = BASESET_DIR; break;
|
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_BASE_SOUNDS: dir = BASESET_DIR; break;
|
||||||
case CONTENT_TYPE_NEWGRF: dir = NEWGRF_DIR; break;
|
case CONTENT_TYPE_NEWGRF: dir = NEWGRF_DIR; break;
|
||||||
case CONTENT_TYPE_AI: dir = AI_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) {
|
if (this->curInfo->type == CONTENT_TYPE_BASE_MUSIC) {
|
||||||
/* Music can't be in a tar. So extract the tar! */
|
/* 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));
|
unlink(GetFullFilename(this->curInfo, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue