mirror of https://github.com/OpenTTD/OpenTTD
Add: Commandline option to skip NewGRF scanning
parent
588fee5473
commit
0dce7bf85d
|
@ -575,6 +575,10 @@ compatible_grf:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Set this flag to prevent any NewGRF scanning from being done. */
|
||||||
|
int _skip_all_newgrf_scanning = 0;
|
||||||
|
|
||||||
/** Helper for scanning for files with GRF as extension */
|
/** Helper for scanning for files with GRF as extension */
|
||||||
class GRFFileScanner : FileScanner {
|
class GRFFileScanner : FileScanner {
|
||||||
std::chrono::steady_clock::time_point next_update; ///< The next moment we do update the screen.
|
std::chrono::steady_clock::time_point next_update; ///< The next moment we do update the screen.
|
||||||
|
@ -591,6 +595,11 @@ public:
|
||||||
/** Do the scan for GRFs. */
|
/** Do the scan for GRFs. */
|
||||||
static uint DoScan()
|
static uint DoScan()
|
||||||
{
|
{
|
||||||
|
if (_skip_all_newgrf_scanning > 0) {
|
||||||
|
if (_skip_all_newgrf_scanning == 1) _skip_all_newgrf_scanning = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
GRFFileScanner fs;
|
GRFFileScanner fs;
|
||||||
int ret = fs.Scan(".grf", NEWGRF_DIR);
|
int ret = fs.Scan(".grf", NEWGRF_DIR);
|
||||||
/* The number scanned and the number returned may not be the same;
|
/* The number scanned and the number returned may not be the same;
|
||||||
|
|
|
@ -201,6 +201,8 @@ static void ShowHelp()
|
||||||
" -x = Never save configuration changes to disk\n"
|
" -x = Never save configuration changes to disk\n"
|
||||||
" -X = Don't use global folders to search for files\n"
|
" -X = Don't use global folders to search for files\n"
|
||||||
" -q savegame = Write some information about the savegame and exit\n"
|
" -q savegame = Write some information about the savegame and exit\n"
|
||||||
|
" -Q = Don't scan for/load NewGRF files on startup\n"
|
||||||
|
" -QQ = Disable NewGRF scanning/loading entirely\n"
|
||||||
"\n",
|
"\n",
|
||||||
lastof(buf)
|
lastof(buf)
|
||||||
);
|
);
|
||||||
|
@ -512,6 +514,7 @@ static const OptionData _options[] = {
|
||||||
GETOPT_SHORT_NOVAL('X'),
|
GETOPT_SHORT_NOVAL('X'),
|
||||||
GETOPT_SHORT_VALUE('q'),
|
GETOPT_SHORT_VALUE('q'),
|
||||||
GETOPT_SHORT_NOVAL('h'),
|
GETOPT_SHORT_NOVAL('h'),
|
||||||
|
GETOPT_SHORT_NOVAL('Q'),
|
||||||
GETOPT_END()
|
GETOPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -640,6 +643,11 @@ int openttd_main(int argc, char *argv[])
|
||||||
WriteSavegameInfo(title);
|
WriteSavegameInfo(title);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
case 'Q': {
|
||||||
|
extern int _skip_all_newgrf_scanning;
|
||||||
|
_skip_all_newgrf_scanning += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'G': scanner->generation_seed = strtoul(mgo.opt, nullptr, 10); break;
|
case 'G': scanner->generation_seed = strtoul(mgo.opt, nullptr, 10); break;
|
||||||
case 'c': _config_file = mgo.opt; break;
|
case 'c': _config_file = mgo.opt; break;
|
||||||
case 'x': scanner->save_config = false; break;
|
case 'x': scanner->save_config = false; break;
|
||||||
|
|
Loading…
Reference in New Issue