# ai_controller.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_controller.hpp 17248 2009-08-21 20:21:05Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef AI_CONTROLLER_HPP
    00013 #define AI_CONTROLLER_HPP
    00014
    00015 #include "../../core/string_compare_type.hpp"
    00016 #include <map>
    00017
    00022 class AIController {
    00023   friend class AIScanner;
    00024   friend class AIInstance;
    00025
    00026 public:
    00027   static const char *GetClassName() { return "AIController"; }
    00028
    00032   AIController();
    00033
    00037   ~AIController();
    00038
    00045   void Start();
    00046
    00051   static uint GetTick();
    00052
    00058   static int GetSetting(const char *name);
    00059
    00070   static uint GetVersion();
    00071
    00082   static void SetCommandDelay(int ticks);
    00083
    00093   static void Sleep(int ticks);
    00094
    00102   static void Print(bool error_msg, const char *message);
    00103
    00104 private:
    00105   typedef std::map<const char *, const char *, StringCompare> LoadedLibraryList;
    00106
    00107   uint ticks;
    00108   LoadedLibraryList loaded_library;
    00109   int loaded_library_count;
    00110
    00114   void RegisterClasses();
    00115
    00126   bool LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len);
    00127
    00131   void AddLoadedLibrary(const char *library_name, const char *fake_class_name);
    00132 };
    00133
    00134 #endif /* AI_CONTROLLER_HPP */