00001 /* $Id: ai_log.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_LOG_HPP 00013 #define AI_LOG_HPP 00014 00015 #include "ai_object.hpp" 00016 00020 class AILog : public AIObject { 00021 /* AIController needs access to Enum and Log, in order to keep the flow from 00022 * OpenTTD core to NoAI API clear and simple. */ 00023 friend class AIController; 00024 00025 public: 00026 static const char *GetClassName() { return "AILog"; } 00027 00028 #ifndef EXPORT_SKIP 00029 00033 enum AILogType { 00034 LOG_SQ_ERROR = 0, 00035 LOG_ERROR = 1, 00036 LOG_SQ_INFO = 2, 00037 LOG_WARNING = 3, 00038 LOG_INFO = 4, 00039 }; 00040 00045 struct LogData { 00046 char **lines; 00047 AILog::AILogType *type; 00048 int count; 00049 int pos; 00050 int used; 00051 }; 00052 #endif /* EXPORT_SKIP */ 00053 00058 static void Info(const char *message); 00059 00064 static void Warning(const char *message); 00065 00070 static void Error(const char *message); 00071 00072 #ifndef EXPORT_SKIP 00073 00077 static void FreeLogPointer(); 00078 #endif /* EXPORT_SKIP */ 00079 00080 private: 00084 static void Log(AILog::AILogType level, const char *message); 00085 }; 00086 00087 #endif /* AI_LOG_HPP */