00001 /* $Id: script_controller.hpp 23632 2011-12-19 21:05:25Z truebrain $ */ 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 SCRIPT_CONTROLLER_HPP 00013 #define SCRIPT_CONTROLLER_HPP 00014 00015 #include "../../company_type.h" 00016 #include "../../core/string_compare_type.hpp" 00017 #include <map> 00018 00025 class ScriptController { 00026 friend class AIScanner; 00027 friend class ScriptInstance; 00028 00029 public: 00034 ScriptController(CompanyID company); 00035 00039 ~ScriptController(); 00040 00047 void Start(); 00048 00053 static uint GetTick(); 00054 00063 static int GetOpsTillSuspend(); 00064 00070 static int GetSetting(const char *name); 00071 00082 static uint GetVersion(); 00083 00094 static void SetCommandDelay(int ticks); 00095 00105 static void Sleep(int ticks); 00106 00114 static void Print(bool error_msg, const char *message); 00115 00124 static HSQOBJECT Import(const char *library, const char *class_name, int version); 00125 00126 private: 00127 typedef std::map<const char *, const char *, StringCompare> LoadedLibraryList; 00128 00129 uint ticks; 00130 LoadedLibraryList loaded_library; 00131 int loaded_library_count; 00132 00136 void RegisterClasses(); 00137 }; 00138 00139 #endif /* SCRIPT_CONTROLLER_HPP */