(svn r24786) -Codechange: Add SettingsProfile enum for difficulty profiles and highscore tables.

This commit is contained in:
frosch
2012-12-05 19:34:45 +00:00
parent 5b2da98ca3
commit a499435351
10 changed files with 60 additions and 41 deletions

View File

@@ -80,13 +80,13 @@ int AIConfig::GetSetting(const char *name) const
{
if (this->info == NULL) {
SettingValueList::const_iterator it = this->settings.find(name);
if (it == this->settings.end() || GetGameSettings().difficulty.diff_level != 3) {
if (it == this->settings.end() || GetGameSettings().difficulty.diff_level != SP_CUSTOM) {
assert(strcmp("start_date", name) == 0);
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;
case 3: return AI::START_NEXT_MEDIUM;
case SP_EASY: return AI::START_NEXT_EASY;
case SP_MEDIUM: return AI::START_NEXT_MEDIUM;
case SP_HARD: return AI::START_NEXT_HARD;
case SP_CUSTOM: return AI::START_NEXT_MEDIUM;
default: NOT_REACHED();
}
}

View File

@@ -422,12 +422,12 @@ struct AISettingsWindow : public Window {
void CheckDifficultyLevel()
{
if (_game_mode == GM_MENU) {
if (_settings_newgame.difficulty.diff_level != 3) {
_settings_newgame.difficulty.diff_level = 3;
if (_settings_newgame.difficulty.diff_level != SP_CUSTOM) {
_settings_newgame.difficulty.diff_level = SP_CUSTOM;
ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, WL_WARNING);
}
} else if (_settings_game.difficulty.diff_level != 3) {
IConsoleSetSetting("difficulty.diff_level", 3);
} else if (_settings_game.difficulty.diff_level != SP_CUSTOM) {
IConsoleSetSetting("difficulty.diff_level", SP_CUSTOM);
}
}