Changeset - r14320:c817132688c6
[Not reviewed]
master
0 3 0
rubidium - 14 years ago 2010-01-21 23:19:50
rubidium@openttd.org
(svn r18883) -Codechange: warn in the difficulty and AI configuration window when setting the number of AIs to non-zero when you don't have AIs
3 files changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1062,12 +1062,13 @@ STR_DISASTERS_OFF                       
 
STR_DISASTERS_ON                                                :On
 

	
 
STR_CITY_APPROVAL_PERMISSIVE                                    :Permissive
 
STR_CITY_APPROVAL_TOLERANT                                      :Tolerant
 
STR_CITY_APPROVAL_HOSTILE                                       :Hostile
 

	
 
STR_WARNING_NO_SUITABLE_AI                                      :{WHITE}No suitable AIs available...{}You can download several AIs via the 'Online Content' system
 
STR_WARNING_DIFFICULTY_TO_CUSTOM                                :{WHITE}This action changed the difficulty level to custom
 

	
 
# Advanced settings window
 
STR_CONFIG_SETTING_CAPTION                                      :{WHITE}Advanced Settings
 

	
 
STR_CONFIG_SETTING_OFF                                          :Off
src/settings.cpp
Show inline comments
 
@@ -55,12 +55,13 @@
 
#include "blitter/factory.hpp"
 
#include "base_media_base.h"
 
#include "gamelog.h"
 
#include "settings_func.h"
 
#include "ini_type.h"
 
#include "ai/ai_config.hpp"
 
#include "ai/ai.hpp"
 
#include "newgrf.h"
 
#include "ship.h"
 
#include "company_base.h"
 
#include "engine_base.h"
 

	
 
#include "void_map.h"
 
@@ -848,12 +849,17 @@ static bool DifficultyChange(int32)
 
		}
 
		SetWindowClassesDirty(WC_SELECT_GAME);
 
	} else {
 
		_settings_game.difficulty.diff_level = 3;
 
	}
 

	
 
	if (((_game_mode == GM_MENU) ? _settings_newgame.difficulty : _settings_game.difficulty).max_no_competitors != 0 &&
 
			AI::GetInfoList()->size() == 0 && (!_networking || _network_server)) {
 
		ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, 0, 0, true);
 
	}
 

	
 
	/* If we are a network-client, update the difficult setting (if it is open).
 
	 * Use this instead of just dirtying the window because we need to load in
 
	 * the new difficulty settings */
 
	if (_networking && FindWindowById(WC_GAME_OPTIONS, 0) != NULL) {
 
		ShowGameDifficulty();
 
	}
src/settings_gui.cpp
Show inline comments
 
@@ -28,12 +28,13 @@
 
#include "highscore.h"
 
#include "base_media_base.h"
 
#include "company_base.h"
 
#include "company_func.h"
 
#include "viewport_func.h"
 
#include "core/geometry_func.hpp"
 
#include "ai/ai.hpp"
 
#include <map>
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
static const StringID _units_dropdown[] = {
 
@@ -650,12 +651,17 @@ public:
 
			/* save value in temporary variable */
 
			WriteValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv, val);
 
			this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
 
			SetDifficultyLevel(3, &this->opt_mod_temp.difficulty); // set difficulty level to custom
 
			this->LowerWidget(GDW_LVL_CUSTOM);
 
			this->InvalidateData();
 

	
 
			if (widget / 3 == 0 && this->opt_mod_temp.difficulty.max_no_competitors != 0 &&
 
					AI::GetInfoList()->size() == 0) {
 
				ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, 0, 0, true);
 
			}
 
			return;
 
		}
 

	
 
		switch (widget) {
 
			case GDW_LVL_EASY:
 
			case GDW_LVL_MEDIUM:
0 comments (0 inline, 0 general)