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
00010
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 enum GRFStatus {
00022 GCS_UNKNOWN,
00023 GCS_DISABLED,
00024 GCS_NOT_FOUND,
00025 GCS_INITIALISED,
00026 GCS_ACTIVATED
00027 };
00028
00030 enum GRFBugs {
00031 GBUG_VEH_LENGTH,
00032 };
00033
00035 enum GRFListCompatibility {
00036 GLC_ALL_GOOD,
00037 GLC_COMPATIBLE,
00038 GLC_NOT_FOUND
00039 };
00040
00041 struct GRFIdentifier {
00042 uint32 grfid;
00043 uint8 md5sum[16];
00044 };
00045
00046 struct GRFError {
00047 char *custom_message;
00048 char *data;
00049 StringID message;
00050 StringID severity;
00051 uint8 num_params;
00052 uint8 param_number[2];
00053 };
00054
00055 struct GRFConfig : public GRFIdentifier {
00056 char *filename;
00057 char *name;
00058 char *info;
00059 GRFError *error;
00060
00061 uint8 flags;
00062 GRFStatus status;
00063 uint32 grf_bugs;
00064 uint32 param[0x80];
00065 uint8 num_params;
00066
00067 struct GRFConfig *next;
00068
00069 bool IsOpenTTDBaseGRF() const;
00070 };
00071
00072
00073 extern GRFConfig *_all_grfs;
00074
00075
00076 extern GRFConfig *_grfconfig;
00077
00078
00079 extern GRFConfig *_grfconfig_newgame;
00080
00081
00082 extern GRFConfig *_grfconfig_static;
00083
00084 void ScanNewGRFFiles();
00085 const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
00086 GRFConfig *GetGRFConfig(uint32 grfid);
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