newgrf_config.h

Go to the documentation of this file.
00001 /* $Id: newgrf_config.h 19258 2010-02-25 21:18:38Z 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 NEWGRF_CONFIG_H
00013 #define NEWGRF_CONFIG_H
00014 
00015 #include "strings_type.h"
00016 #include "core/alloc_type.hpp"
00017 
00019 enum GCF_Flags {
00020   GCF_SYSTEM,     
00021   GCF_UNSAFE,     
00022   GCF_STATIC,     
00023   GCF_COMPATIBLE, 
00024   GCF_COPY,       
00025   GCF_INIT_ONLY,  
00026   GCF_RESERVED,   
00027 
00028 };
00029 
00031 enum GRFStatus {
00032   GCS_UNKNOWN,      
00033   GCS_DISABLED,     
00034   GCS_NOT_FOUND,    
00035   GCS_INITIALISED,  
00036   GCS_ACTIVATED     
00037 };
00038 
00040 enum GRFBugs {
00041   GBUG_VEH_LENGTH,  
00042   GBUG_VEH_REFIT,   
00043 };
00044 
00046 enum GRFListCompatibility {
00047   GLC_ALL_GOOD,   
00048   GLC_COMPATIBLE, 
00049   GLC_NOT_FOUND   
00050 };
00051 
00053 struct GRFIdentifier {
00054   uint32 grfid;     
00055   uint8 md5sum[16]; 
00056 };
00057 
00059 struct GRFError : ZeroedMemoryAllocator {
00060   GRFError(StringID severity, StringID message = 0);
00061   ~GRFError();
00062 
00063   char *custom_message;  
00064   char *data;            
00065   StringID message;      
00066   StringID severity;     
00067   uint8 num_params;      
00068   uint32 param_value[2]; 
00069 };
00070 
00072 struct GRFConfig : public GRFIdentifier {
00073   char *filename;     
00074   char *name;         
00075   char *info;         
00076   GRFError *error;    
00077 
00078   uint8 flags;        
00079   GRFStatus status;   
00080   uint32 grf_bugs;    
00081   uint32 param[0x80]; 
00082   uint8 num_params;   
00083   bool windows_paletted;  
00084 
00085   struct GRFConfig *next; 
00086 
00087   bool IsOpenTTDBaseGRF() const;
00088 };
00089 
00090 extern GRFConfig *_all_grfs;          
00091 extern GRFConfig *_grfconfig;         
00092 extern GRFConfig *_grfconfig_newgame; 
00093 extern GRFConfig *_grfconfig_static;  
00094 
00095 void ScanNewGRFFiles();
00096 const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
00097 GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask = 0xFFFFFFFF);
00098 GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only);
00099 void AppendStaticGRFConfigs(GRFConfig **dst);
00100 void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el);
00101 void ClearGRFConfig(GRFConfig **config);
00102 void ClearGRFConfigList(GRFConfig **config);
00103 void ResetGRFConfig(bool defaults);
00104 GRFListCompatibility IsGoodGRFConfigList();
00105 bool FillGRFDetails(GRFConfig *config, bool is_static);
00106 char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last);
00107 GRFConfig *DuplicateGRFConfig(const GRFConfig *c);
00108 
00109 /* In newgrf_gui.cpp */
00110 void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config);
00111 
00112 #ifdef ENABLE_NETWORK
00113 /* For communication about GRFs over the network */
00114 #define UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>"
00115 char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
00116 #endif /* ENABLE_NETWORK */
00117 
00118 #endif /* NEWGRF_CONFIG_H */

Generated on Fri Apr 30 21:55:22 2010 for OpenTTD by  doxygen 1.6.1