From 4ec6c19d449ea010432bb4972910bffc6ed2c548 Mon Sep 17 00:00:00 2001 From: yexo Date: Sun, 2 Jan 2011 12:52:37 +0000 Subject: (svn r21697) -Codechange: use GetGameSettings() in a few more places to enhance readability --- src/ai/ai_config.cpp | 4 ++-- src/ai/ai_info.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ai') diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp index 1c50a1d01..81d26dc53 100644 --- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -108,10 +108,10 @@ int AIConfig::GetSetting(const char *name) const { SettingValueList::const_iterator it = this->settings.find(name); /* Return the default value if the setting is not set, or if we are in a not-custom difficult level */ - if (it == this->settings.end() || ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) != 3) { + if (it == this->settings.end() || GetGameSettings().difficulty.diff_level != 3) { if (this->info == NULL) { assert(strcmp("start_date", name) == 0); - switch ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) { + switch (GetGameSettings().difficulty.diff_level) { case 0: return AI::START_NEXT_EASY; case 1: return AI::START_NEXT_MEDIUM; case 2: return AI::START_NEXT_HARD; diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 2194f20c5..73a7ba05b 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -338,7 +338,7 @@ int AIInfo::GetSettingDefaultValue(const char *name) const for (AIConfigItemList::const_iterator it = this->config_list.begin(); it != this->config_list.end(); it++) { if (strcmp((*it).name, name) != 0) continue; /* The default value depends on the difficulty level */ - switch ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) { + switch (GetGameSettings().difficulty.diff_level) { case 0: return (*it).easy_value; case 1: return (*it).medium_value; case 2: return (*it).hard_value; -- cgit v1.2.3-54-g00ecf