Loading

Paste #p6oqrm63s

  1. void MakeNewgameSettingsLive()
  2. {
  3.     for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
  4.         if (_settings_game.ai_config[c] != NULL) {
  5.             delete _settings_game.ai_config[c];
  6.         }
  7.     }
  8.     if (_settings_game.game_config != NULL) {
  9.         delete _settings_game.game_config;
  10.     }
  11.  
  12.     /* Copy newgame settings to active settings.
  13.      * Also initialise old settings needed for savegame conversion. */
  14.     _settings_game = _settings_newgame;
  15.     _old_vds = _settings_client.company.vehicle;
  16.  
  17.     for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
  18.         _settings_game.ai_config[c] = NULL;
  19.         if (_settings_newgame.ai_config[c] != NULL) {
  20.             _settings_game.ai_config[c] = new AIConfig(_settings_newgame.ai_config[c]);
  21.             if (!AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->HasScript()) AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->Change(NULL, -1, false, true);
  22.             }
  23.         }
  24.     _settings_game.game_config = NULL;
  25.     if (_settings_newgame.game_config != NULL) {
  26.         _settings_game.game_config = new GameConfig(_settings_newgame.game_config);
  27.     }
  28. }

Comments