# newgrf_config.h

Go to the documentation of this file.

    00001 /* $Id: newgrf_config.h 15114 2009-01-16 19:53:52Z peter1138 $ */
    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 };
    00035
    00037 enum GRFListCompatibility {
    00038   GLC_ALL_GOOD,
    00039   GLC_COMPATIBLE,
    00040   GLC_NOT_FOUND
    00041 };
    00042
    00044 struct GRFIdentifier {
    00045   uint32 grfid;
    00046   uint8 md5sum[16];
    00047 };
    00048
    00050 struct GRFError {
    00051   char *custom_message;
    00052   char *data;
    00053   StringID message;
    00054   StringID severity;
    00055   uint8 num_params;
    00056   uint8 param_number[2];
    00057 };
    00058
    00060 struct GRFConfig : public GRFIdentifier {
    00061   char *filename;
    00062   char *name;
    00063   char *info;
    00064   GRFError *error;
    00065
    00066   uint8 flags;
    00067   GRFStatus status;
    00068   uint32 grf_bugs;
    00069   uint32 param[0x80];
    00070   uint8 num_params;
    00071   bool windows_paletted;
    00072
    00073   struct GRFConfig *next;
    00074
    00075   bool IsOpenTTDBaseGRF() const;
    00076 };
    00077
    00078 extern GRFConfig *_all_grfs;
    00079 extern GRFConfig *_grfconfig;
    00080 extern GRFConfig *_grfconfig_newgame;
    00081 extern GRFConfig *_grfconfig_static;
    00082
    00083 void ScanNewGRFFiles();
    00084 const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
    00085 GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask = 0xFFFFFFFF);
    00086 GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only);
    00087 void AppendStaticGRFConfigs(GRFConfig **dst);
    00088 void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el);
    00089 void ClearGRFConfig(GRFConfig **config);
    00090 void ClearGRFConfigList(GRFConfig **config);
    00091 void ResetGRFConfig(bool defaults);
    00092 GRFListCompatibility IsGoodGRFConfigList();
    00093 bool FillGRFDetails(GRFConfig *config, bool is_static);
    00094 char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last);
    00095
    00096 /* In newgrf_gui.cpp */
    00097 void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config);
    00098
    00099 #ifdef ENABLE_NETWORK
    00100 /* For communication about GRFs over the network */
    00101 #define UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>"
    00102 char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
    00103 #endif /* ENABLE_NETWORK */
    00104
    00105 #endif /* NEWGRF_CONFIG_H */