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_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: 00027 static const char *GetClassName() { return "AILog"; } 00028 00029 #ifndef EXPORT_SKIP 00030 00034 enum AILogType { 00035 LOG_SQ_ERROR = 0, 00036 LOG_ERROR = 1, 00037 LOG_SQ_INFO = 2, 00038 LOG_WARNING = 3, 00039 LOG_INFO = 4, 00040 }; 00041 00046 struct LogData { 00047 char **lines; 00048 AILog::AILogType *type; 00049 int count; 00050 int pos; 00051 int used; 00052 }; 00053 #endif /* EXPORT_SKIP */ 00054 00059 static void Info(const char *message); 00060 00065 static void Warning(const char *message); 00066 00071 static void Error(const char *message); 00072 00073 #ifndef EXPORT_SKIP 00074 00078 static void FreeLogPointer(); 00079 #endif /* EXPORT_SKIP */ 00080 00081 private: 00085 static void Log(AILog::AILogType level, const char *message); 00086 }; 00087 00088 #endif /* AI_LOG_HPP */