diff src/settings_gui.cpp @ 14330:9caa7d57a6e3 draft

(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
author rubidium <rubidium@openttd.org>
date Thu, 21 Jan 2010 23:19:50 +0000
parents a899d4e5ee1a
children a3c6860ea115
line wrap: on
line diff
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -31,6 +31,7 @@
 #include "company_func.h"
 #include "viewport_func.h"
 #include "core/geometry_func.hpp"
+#include "ai/ai.hpp"
 #include <map>
 
 #include "table/sprites.h"
@@ -653,6 +654,11 @@
 			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;
 		}