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
commit598d20eedcfb9ac05877b48171604e115d38a46c (patch)
treef078747297abae0d4c76406a0b8e0d6b37a2a9c5 /src/ai
parent057ceec51c0080826d9c3f2e1cf914d307f734a8 (diff)
downloadopenttd-598d20eedcfb9ac05877b48171604e115d38a46c.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;