# ai_controller.hpp

Go to the documentation of this file.

    00001 /* $Id$ */
    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:
    00028   static const char *GetClassName() { return "AIController"; }
    00029
    00033   AIController();
    00034
    00038   ~AIController();
    00039
    00046   void Start();
    00047
    00052   static uint GetTick();
    00053
    00059   static int GetSetting(const char *name);
    00060
    00071   static uint GetVersion();
    00072
    00083   static void SetCommandDelay(int ticks);
    00084
    00094   static void Sleep(int ticks);
    00095
    00103   static void Print(bool error_msg, const char *message);
    00104
    00105 private:
    00106   typedef std::map<const char *, const char *, StringCompare> LoadedLibraryList;
    00107
    00108   uint ticks;
    00109   LoadedLibraryList loaded_library;
    00110   int loaded_library_count;
    00111
    00115   void RegisterClasses();
    00116
    00127   bool LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len);
    00128
    00132   void AddLoadedLibrary(const char *library_name, const char *fake_class_name);
    00133 };
    00134
    00135 #endif /* AI_CONTROLLER_HPP */