Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/commit-checker.yml # src/openttd.cpp
This commit is contained in:
@@ -98,6 +98,8 @@ extern Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMP
|
||||
extern void ShowOSErrorBox(const char *buf, bool system);
|
||||
extern char *_config_file;
|
||||
|
||||
bool _save_config = false;
|
||||
|
||||
GameEventFlags _game_events_since_load;
|
||||
GameEventFlags _game_events_overall;
|
||||
|
||||
@@ -227,7 +229,7 @@ static void ShowHelp()
|
||||
" -S sounds_set = Force the sounds set (see below)\n"
|
||||
" -M music_set = Force the music set (see below)\n"
|
||||
" -c config_file = Use 'config_file' instead of 'openttd.cfg'\n"
|
||||
" -x = Do not automatically save to config file on exit\n"
|
||||
" -x = Never save configuration changes to disk\n"
|
||||
" -q savegame = Write some information about the savegame and exit\n"
|
||||
" -Z = Write detailed version information and exit\n"
|
||||
"\n",
|
||||
@@ -533,19 +535,16 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||
char *network_conn; ///< Information about the server to connect to, or nullptr.
|
||||
const char *join_server_password; ///< The password to join the server with.
|
||||
const char *join_company_password; ///< The password to join the company with.
|
||||
bool *save_config_ptr; ///< The pointer to the save config setting.
|
||||
bool save_config; ///< The save config setting.
|
||||
|
||||
/**
|
||||
* Create a new callback.
|
||||
* @param save_config_ptr Pointer to the save_config local variable which
|
||||
* decides whether to save of exit or not.
|
||||
*/
|
||||
AfterNewGRFScan(bool *save_config_ptr) :
|
||||
AfterNewGRFScan() :
|
||||
startyear(INVALID_YEAR), generation_seed(GENERATE_NEW_SEED),
|
||||
dedicated_host(nullptr), dedicated_port(0), network_conn(nullptr),
|
||||
join_server_password(nullptr), join_company_password(nullptr),
|
||||
save_config_ptr(save_config_ptr), save_config(true)
|
||||
save_config(true)
|
||||
{
|
||||
/* Visual C++ 2015 fails compiling this line (AfterNewGRFScan::generation_seed undefined symbol)
|
||||
* if it's placed outside a member function, directly in the struct body. */
|
||||
@@ -576,7 +575,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||
WindowDesc::LoadFromConfig();
|
||||
|
||||
/* We have loaded the config, so we may possibly save it. */
|
||||
*save_config_ptr = save_config;
|
||||
_save_config = save_config;
|
||||
|
||||
/* restore saved music volume */
|
||||
MusicDriver::GetInstance()->SetVolume(_settings_client.music.music_vol);
|
||||
@@ -683,9 +682,7 @@ int openttd_main(int argc, char *argv[])
|
||||
std::string sounds_set;
|
||||
std::string music_set;
|
||||
Dimension resolution = {0, 0};
|
||||
/* AfterNewGRFScan sets save_config to true after scanning completed. */
|
||||
bool save_config = false;
|
||||
std::unique_ptr<AfterNewGRFScan> scanner(new AfterNewGRFScan(&save_config));
|
||||
std::unique_ptr<AfterNewGRFScan> scanner(new AfterNewGRFScan());
|
||||
bool dedicated = false;
|
||||
char *debuglog_conn = nullptr;
|
||||
|
||||
@@ -1004,7 +1001,7 @@ int openttd_main(int argc, char *argv[])
|
||||
WaitTillGeneratedWorld(); // Make sure any generate world threads have been joined.
|
||||
|
||||
/* only save config if we have to */
|
||||
if (save_config) {
|
||||
if (_save_config) {
|
||||
SaveToConfig();
|
||||
SaveHotkeysToConfig();
|
||||
WindowDesc::SaveToConfig();
|
||||
@@ -1298,7 +1295,7 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
|
||||
case SM_MENU: // Switch to game intro menu
|
||||
LoadIntroGame();
|
||||
if (BaseSounds::ini_set.empty() && BaseSounds::GetUsedSet()->fallback) {
|
||||
if (BaseSounds::ini_set.empty() && BaseSounds::GetUsedSet()->fallback && SoundDriver::GetInstance()->HasOutput()) {
|
||||
ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, WL_CRITICAL);
|
||||
BaseSounds::ini_set = BaseSounds::GetUsedSet()->name;
|
||||
}
|
||||
|
Reference in New Issue
Block a user