newgrf_config.h
Go to the documentation of this file.00001
00002
00005 #ifndef NEWGRF_CONFIG_H
00006 #define NEWGRF_CONFIG_H
00007
00008 #include "strings_type.h"
00009
00011 enum GCF_Flags {
00012 GCF_SYSTEM,
00013 GCF_UNSAFE,
00014 GCF_STATIC,
00015 GCF_COMPATIBLE,
00016 GCF_COPY,
00017 GCF_INIT_ONLY,
00018 GCF_RESERVED,
00019
00020 };
00021
00023 enum GRFStatus {
00024 GCS_UNKNOWN,
00025 GCS_DISABLED,
00026 GCS_NOT_FOUND,
00027 GCS_INITIALISED,
00028 GCS_ACTIVATED
00029 };
00030
00032 enum GRFBugs {
00033 GBUG_VEH_LENGTH,
00034 GBUG_VEH_REFIT,
00035 };
00036
00038 enum GRFListCompatibility {
00039 GLC_ALL_GOOD,
00040 GLC_COMPATIBLE,
00041 GLC_NOT_FOUND
00042 };
00043
00045 struct GRFIdentifier {
00046 uint32 grfid;
00047 uint8 md5sum[16];
00048 };
00049
00051 struct GRFError {
00052 char *custom_message;
00053 char *data;
00054 StringID message;
00055 StringID severity;
00056 uint8 num_params;
00057 uint8 param_number[2];
00058 };
00059
00061 struct GRFConfig : public GRFIdentifier {
00062 char *filename;
00063 char *name;
00064 char *info;
00065 GRFError *error;
00066
00067 uint8 flags;
00068 GRFStatus status;
00069 uint32 grf_bugs;
00070 uint32 param[0x80];
00071 uint8 num_params;
00072 bool windows_paletted;
00073
00074 struct GRFConfig *next;
00075
00076 bool IsOpenTTDBaseGRF() const;
00077 };
00078
00079 extern GRFConfig *_all_grfs;
00080 extern GRFConfig *_grfconfig;
00081 extern GRFConfig *_grfconfig_newgame;
00082 extern GRFConfig *_grfconfig_static;
00083
00084 void ScanNewGRFFiles();
00085 const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
00086 GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask = 0xFFFFFFFF);
00087 GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only);
00088 void AppendStaticGRFConfigs(GRFConfig **dst);
00089 void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el);
00090 void ClearGRFConfig(GRFConfig **config);
00091 void ClearGRFConfigList(GRFConfig **config);
00092 void ResetGRFConfig(bool defaults);
00093 GRFListCompatibility IsGoodGRFConfigList();
00094 bool FillGRFDetails(GRFConfig *config, bool is_static);
00095 char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last);
00096
00097
00098 void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config);
00099
00100 #ifdef ENABLE_NETWORK
00101
00102 #define UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>"
00103 char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
00104 #endif
00105
00106 #endif