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 SCRIPT_CONTROLLER_HPP 00013 #define SCRIPT_CONTROLLER_HPP 00014 00015 #include "../../core/string_compare_type.hpp" 00016 #include <map> 00017 00024 class ScriptController { 00025 friend class AIScanner; 00026 friend class ScriptInstance; 00027 00028 public: 00032 ScriptController(); 00033 00037 ~ScriptController(); 00038 00045 void Start(); 00046 00051 static uint GetTick(); 00052 00061 static int GetOpsTillSuspend(); 00062 00068 static int GetSetting(const char *name); 00069 00080 static uint GetVersion(); 00081 00092 static void SetCommandDelay(int ticks); 00093 00103 static void Sleep(int ticks); 00104 00112 static void Print(bool error_msg, const char *message); 00113 00122 static HSQOBJECT Import(const char *library, const char *class_name, int version); 00123 00124 private: 00125 typedef std::map<const char *, const char *, StringCompare> LoadedLibraryList; 00126 00127 uint ticks; 00128 LoadedLibraryList loaded_library; 00129 int loaded_library_count; 00130 00134 void RegisterClasses(); 00135 }; 00136 00137 #endif /* SCRIPT_CONTROLLER_HPP */