error.h

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 ERROR_H
00013 #define ERROR_H
00014 
00015 #include "strings_type.h"
00016 #include "company_type.h"
00017 #include "core/geometry_type.hpp"
00018 
00020 enum WarningLevel {
00021   WL_INFO,     
00022   WL_WARNING,  
00023   WL_ERROR,    
00024   WL_CRITICAL, 
00025 };
00026 
00028 class ErrorMessageData {
00029 protected:
00030   uint duration;                  
00031   uint64 decode_params[20];       
00032   const char *strings[20];        
00033   uint textref_stack_size;        
00034   uint32 textref_stack[16];       
00035   StringID summary_msg;           
00036   StringID detailed_msg;          
00037   Point position;                 
00038   CompanyID face;                 
00039 
00040 public:
00041   ErrorMessageData(const ErrorMessageData &data);
00042   ~ErrorMessageData();
00043   ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration = 0, int x = 0, int y = 0, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
00044 
00045   void SetDParam(uint n, uint64 v);
00046   void SetDParamStr(uint n, const char *str);
00047 
00048   void CopyOutDParams();
00049 };
00050 
00051 void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
00052 void ClearErrorMessages();
00053 void ShowFirstError();
00054 void UnshowCriticalError();
00055 
00056 #endif /* ERROR_H */