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