summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-02-21 02:34:53 +0000
committeryexo <yexo@openttd.org>2009-02-21 02:34:53 +0000
commitc3c549f73105b88cf728744587821721a9e45c0f (patch)
treef078747297abae0d4c76406a0b8e0d6b37a2a9c5 /src/ai
parent13bc604fde0f4d3f3620809507cfe045c1b96b4b (diff)
downloadopenttd-c3c549f73105b88cf728744587821721a9e45c0f.tar.xz
(svn r15538) -Fix (r15334): The difficulty level wasn't set to custom when changing the amount of towns/industries from the newgame gui.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 3b09f0220..5aae9938c 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -16,6 +16,7 @@
#include "../string_func.h"
#include "../textbuf_gui.h"
#include "../settings_type.h"
+#include "../settings_func.h"
#include "../network/network_content.h"
#include "ai.hpp"
@@ -485,15 +486,13 @@ struct AIConfigWindow : public Window {
case AIC_WIDGET_BACKGROUND: {
/* Check if the user clicked on one of the arrows to configure the number of AIs */
if (IsInsideBS(pt.x, 10, 20) && IsInsideBS(pt.y, 18, 10)) {
+ int new_value;
if (pt.x <= 20) {
- _settings_newgame.difficulty.max_no_competitors = max(0, _settings_newgame.difficulty.max_no_competitors - 1);
+ new_value = max(0, _settings_newgame.difficulty.max_no_competitors - 1);
} else {
- _settings_newgame.difficulty.max_no_competitors = min(MAX_COMPANIES - 1, _settings_newgame.difficulty.max_no_competitors + 1);
- }
- if (_settings_newgame.difficulty.diff_level != 3) {
- _settings_newgame.difficulty.diff_level = 3;
- ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
+ new_value = min(MAX_COMPANIES - 1, _settings_newgame.difficulty.max_no_competitors + 1);
}
+ IConsoleSetSetting("difficulty.max_no_competitors", new_value);
this->SetDirty();
}
break;