(svn r19429) -Fix: when the title game contains an AIPL block the AI settinsg where overwritten by those from the title game
This commit is contained in:
@@ -93,13 +93,13 @@ const AIConfigItemList *AIConfig::GetConfigList()
|
||||
return this->config_list;
|
||||
}
|
||||
|
||||
AIConfig *AIConfig::GetConfig(CompanyID company, bool forceNewgameSetting)
|
||||
AIConfig *AIConfig::GetConfig(CompanyID company, AISettingSource source)
|
||||
{
|
||||
AIConfig **config;
|
||||
if (!forceNewgameSetting) {
|
||||
config = (_game_mode == GM_MENU) ? &_settings_newgame.ai_config[company] : &_settings_game.ai_config[company];
|
||||
} else {
|
||||
if (source == AISS_FORCE_NEWGAME || (source == AISS_DEFAULT && _game_mode == GM_MENU)) {
|
||||
config = &_settings_newgame.ai_config[company];
|
||||
} else {
|
||||
config = &_settings_game.ai_config[company];
|
||||
}
|
||||
if (*config == NULL) *config = new AIConfig();
|
||||
return *config;
|
||||
|
@@ -61,10 +61,18 @@ public:
|
||||
*/
|
||||
const AIConfigItemList *GetConfigList();
|
||||
|
||||
/* Where to get the config from, either default (depends on current game
|
||||
* mode) or force either newgame or normal */
|
||||
enum AISettingSource {
|
||||
AISS_DEFAULT, ///< Get the AI config from the current game mode
|
||||
AISS_FORCE_NEWGAME, ///< Get the newgame AI config
|
||||
AISS_FORCE_GAME, ///< Get the AI config from the current game
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the config of a company.
|
||||
*/
|
||||
static AIConfig *GetConfig(CompanyID company, bool forceNewgameSetting = false);
|
||||
static AIConfig *GetConfig(CompanyID company, AISettingSource source = AISS_DEFAULT);
|
||||
|
||||
/**
|
||||
* Get the value of a setting for this config. It might fallback to his
|
||||
|
Reference in New Issue
Block a user