From 21bd2722cd89995370523385c213da32c8d47100 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 10 Feb 2010 16:24:05 +0000 Subject: (svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel --- src/ai/ai.hpp | 23 +++++++++++++++++++++++ src/ai/ai_config.hpp | 2 ++ src/ai/ai_gui.hpp | 10 ++++++++++ src/ai/ai_info.hpp | 3 +++ 4 files changed, 38 insertions(+) (limited to 'src/ai') diff --git a/src/ai/ai.hpp b/src/ai/ai.hpp index 65ad7705f..495a030a1 100644 --- a/src/ai/ai.hpp +++ b/src/ai/ai.hpp @@ -12,6 +12,7 @@ #ifndef AI_HPP #define AI_HPP +#ifdef ENABLE_AI #include "api/ai_event_types.hpp" #include "../date_type.h" #include "../core/string_compare_type.hpp" @@ -125,4 +126,26 @@ private: static class AIScanner *ai_scanner; }; +#else /* ENABLE_AI */ + +#include "../company_type.h" + +#define NewEvent(cid, event) nop() +#define BroadcastNewEvent(...) nop() + +class AI { +public: + static void StartNew(CompanyID company, bool rerandomise_ai = true) {} + static void Stop(CompanyID company) {} + static void Initialize() {} + static void Uninitialize(bool keepConfig) {} + static void KillAll() {} + static void GameLoop() {} + static bool HasAI(const struct ContentInfo *ci, bool md5sum) { return false; } + static void Rescan() {} + static char *GetConsoleList(char *p, const char *last) { return p; } + static void nop() { } +}; + +#endif /* ENABLE_AI */ #endif /* AI_HPP */ diff --git a/src/ai/ai_config.hpp b/src/ai/ai_config.hpp index 3eb9d78d2..05afda9d6 100644 --- a/src/ai/ai_config.hpp +++ b/src/ai/ai_config.hpp @@ -11,6 +11,7 @@ #ifndef AI_CONFIG_HPP #define AI_CONFIG_HPP +#ifdef ENABLE_AI #include #include "ai_info.hpp" @@ -130,4 +131,5 @@ private: bool is_random_ai; }; +#endif /* ENABLE_AI */ #endif /* AI_CONFIG_HPP */ diff --git a/src/ai/ai_gui.hpp b/src/ai/ai_gui.hpp index 56d775a16..254e2955c 100644 --- a/src/ai/ai_gui.hpp +++ b/src/ai/ai_gui.hpp @@ -14,7 +14,17 @@ #include "../company_type.h" +#ifdef ENABLE_AI void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY); void ShowAIConfigWindow(); +#else +#include "table/strings.h" + +static inline void ShowAIConfigWindow() +{ + ShowErrorMessage(STR_ERROR_NO_AI, STR_ERROR_NO_AI_SUB, 0, 0); +} +static inline void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY) {ShowAIConfigWindow();} +#endif /* ENABLE_AI */ #endif /* AI_GUI_HPP */ diff --git a/src/ai/ai_info.hpp b/src/ai/ai_info.hpp index e3b116b3e..9ef6e3df1 100644 --- a/src/ai/ai_info.hpp +++ b/src/ai/ai_info.hpp @@ -12,6 +12,8 @@ #ifndef AI_INFO #define AI_INFO +#ifdef ENABLE_AI + #include #include "../core/smallmap_type.hpp" #include "../script/script_info.hpp" @@ -141,4 +143,5 @@ private: const char *category; }; +#endif /* ENABLE_AI */ #endif /* AI_INFO */ -- cgit v1.2.3-54-g00ecf