Fall back to demo/ if no gamedata can be found in base/

The demo game data is in demo/ instead of base/, so try to fall back
to that to cause minimal confusion.
This commit is contained in:
Daniel Gibson 2019-01-04 22:50:06 +01:00
parent 42886f0e4b
commit efd814a4e0

View file

@ -2676,12 +2676,20 @@ void idFileSystemLocal::Init( void ) {
// spawn a thread to handle background file reads
StartBackgroundDownloadThread();
// if we can't find default.cfg, assume that the paths are
// busted and error out now, rather than getting an unreadable
// graphics screen when the font fails to load
// Dedicated servers can run with no outside files at all
if ( ReadFile( "default.cfg", NULL, NULL ) <= 0 ) {
common->FatalError( "Couldn't load default.cfg" );
// DG: the demo gamedata is in demo/ instead of base/. to make it "just work", add a fallback for that
if(fs_game.GetString()[0] == '\0' || idStr::Icmp(fs_game.GetString(), BASE_GAMEDIR) == 0) {
common->Warning("Couldn't find default.cfg in %s/, trying again with demo/\n", BASE_GAMEDIR);
fs_game.SetString("demo");
fs_game_base.SetString("demo");
Restart();
} else {
// if we can't find default.cfg, assume that the paths are
// busted and error out now, rather than getting an unreadable
// graphics screen when the font fails to load
// Dedicated servers can run with no outside files at all
common->FatalError( "Couldn't load default.cfg" );
}
}
}
@ -2696,6 +2704,9 @@ void idFileSystemLocal::Restart( void ) {
Startup( );
// spawn a thread to handle background file reads
StartBackgroundDownloadThread();
// if we can't find default.cfg, assume that the paths are
// busted and error out now, rather than getting an unreadable
// graphics screen when the font fails to load