script_log.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 SCRIPT_LOG_HPP
00013 #define SCRIPT_LOG_HPP
00014 
00015 #include "script_object.hpp"
00016 
00021 class ScriptLog : public ScriptObject {
00022   /* ScriptController needs access to Enum and Log, in order to keep the flow from
00023    *  OpenTTD core to NoAI API clear and simple. */
00024   friend class ScriptController;
00025 
00026 public:
00032   enum ScriptLogType {
00033     LOG_SQ_ERROR = 0, 
00034     LOG_ERROR = 1,    
00035     LOG_SQ_INFO = 2,  
00036     LOG_WARNING = 3,  
00037     LOG_INFO = 4,     
00038   };
00039 
00045   struct LogData {
00046     char **lines;           
00047     ScriptLog::ScriptLogType *type; 
00048     int count;              
00049     int pos;                
00050     int used;               
00051   };
00052 
00057   static void Info(const char *message);
00058 
00063   static void Warning(const char *message);
00064 
00069   static void Error(const char *message);
00070 
00075   static void FreeLogPointer();
00076 
00077 private:
00081   static void Log(ScriptLog::ScriptLogType level, const char *message);
00082 };
00083 
00084 #endif /* SCRIPT_LOG_HPP */