void MakeNewgameSettingsLive() { for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { if (_settings_game.ai_config[c] != NULL) { delete _settings_game.ai_config[c]; } } if (_settings_game.game_config != NULL) { delete _settings_game.game_config; } /* Copy newgame settings to active settings. * Also initialise old settings needed for savegame conversion. */ _settings_game = _settings_newgame; _old_vds = _settings_client.company.vehicle; for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { _settings_game.ai_config[c] = NULL; if (_settings_newgame.ai_config[c] != NULL) { _settings_game.ai_config[c] = new AIConfig(_settings_newgame.ai_config[c]); if (!AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->HasScript()) AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->Change(NULL, -1, false, true); } } _settings_game.game_config = NULL; if (_settings_newgame.game_config != NULL) { _settings_game.game_config = new GameConfig(_settings_newgame.game_config); } }