# newgrf_config.h

Go to the documentation of this file.

    00001 /* $Id: newgrf_config.h 17248 2009-08-21 20:21:05Z 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
    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
    00104 /* In newgrf_gui.cpp */
    00105 void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config);
    00106
    00107 #ifdef ENABLE_NETWORK
    00108 /* For communication about GRFs over the network */
    00109 #define UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>"
    00110 char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
    00111 #endif /* ENABLE_NETWORK */
    00112
    00113 #endif /* NEWGRF_CONFIG_H */