ai.hpp
Go to the documentation of this file.00001
00002
00005 #ifndef AI_HPP
00006 #define AI_HPP
00007
00008 #include "api/ai_event_types.hpp"
00009 #include "../date_type.h"
00010 #include "../core/string_compare_type.hpp"
00011
00012 typedef std::map<const char *, class AIInfo *, StringCompare> AIInfoList;
00013
00014
00015 void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2);
00016
00017 class AI {
00018 public:
00022 enum StartNext {
00023 START_NEXT_EASY = DAYS_IN_YEAR * 2,
00024 START_NEXT_MEDIUM = DAYS_IN_YEAR,
00025 START_NEXT_HARD = DAYS_IN_YEAR / 2,
00026 START_NEXT_MIN = 1,
00027 START_NEXT_MAX = 3600,
00028 START_NEXT_DEVIATION = 60,
00029 };
00030
00035 static bool CanStartNew();
00036
00041 static void StartNew(CompanyID company);
00042
00046 static void GameLoop();
00047
00051 static uint GetTick();
00052
00058 static void Stop(CompanyID company);
00059
00063 static void KillAll();
00064
00068 static void Initialize();
00069
00074 static void Uninitialize(bool keepConfig);
00075
00080 static void ResetConfig();
00081
00085 static void NewEvent(CompanyID company, AIEvent *event);
00086
00090 static void BroadcastNewEvent(AIEvent *event, CompanyID skip_company = MAX_COMPANIES);
00091
00095 static void Save(CompanyID company);
00096
00100 static void Load(CompanyID company, int version);
00101
00105 static int GetStartNextTime();
00106
00107 static char *GetConsoleList(char *p, const char *last);
00108 static const AIInfoList *GetInfoList();
00109 static const AIInfoList *GetUniqueInfoList();
00110 static AIInfo *FindInfo(const char *name, int version);
00111 static bool ImportLibrary(const char *library, const char *class_name, int version, HSQUIRRELVM vm);
00112 static void Rescan();
00113 #if defined(ENABLE_NETWORK)
00114 static bool HasAI(const struct ContentInfo *ci, bool md5sum);
00115 #endif
00116 private:
00117 static uint frame_counter;
00118 static class AIScanner *ai_scanner;
00119 };
00120
00121 #endif