2006-12-04 08:30:04 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-03-21 03:06:21 +00:00
|
|
|
/** @file newgrf_config.h */
|
|
|
|
|
2006-12-04 08:30:04 +00:00
|
|
|
#ifndef NEWGRF_CONFIG_H
|
|
|
|
#define NEWGRF_CONFIG_H
|
|
|
|
|
2007-02-24 16:34:37 +00:00
|
|
|
#include "openttd.h"
|
|
|
|
|
2006-12-04 08:30:04 +00:00
|
|
|
/* GRF config bit flags */
|
2007-03-07 12:11:48 +00:00
|
|
|
enum GCF_Flags {
|
2007-01-13 17:42:50 +00:00
|
|
|
GCF_SYSTEM, ///< GRF file is an openttd-internal system grf
|
|
|
|
GCF_UNSAFE, ///< GRF file is unsafe for static usage
|
|
|
|
GCF_STATIC, ///< GRF file is used statically (can be used in any MP game)
|
|
|
|
GCF_COMPATIBLE,///< GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
|
2006-12-18 12:26:55 +00:00
|
|
|
GCF_COPY, ///< The data is copied from a grf in _all_grfs
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2006-12-04 08:30:04 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
enum GRFStatus {
|
2007-03-06 19:33:28 +00:00
|
|
|
GCS_UNKNOWN, ///< The status of this grf file is unknown
|
|
|
|
GCS_DISABLED, ///< GRF file is disabled
|
|
|
|
GCS_NOT_FOUND, ///< GRF file was not found in the local cache
|
|
|
|
GCS_INITIALISED, ///< GRF file has been initialised
|
|
|
|
GCS_ACTIVATED ///< GRF file has been activated
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2007-03-06 19:33:28 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
enum GRFListCompatibility{
|
2007-03-06 19:33:28 +00:00
|
|
|
GLC_ALL_GOOD,
|
|
|
|
GLC_COMPATIBLE,
|
|
|
|
GLC_NOT_FOUND
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2007-03-06 19:33:28 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct GRFIdentifier {
|
2007-01-21 17:29:38 +00:00
|
|
|
uint32 grfid;
|
|
|
|
uint8 md5sum[16];
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2007-01-21 17:29:38 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct GRFError {
|
2007-02-24 16:34:37 +00:00
|
|
|
StringID message;
|
|
|
|
StringID data;
|
|
|
|
StringID severity;
|
|
|
|
uint8 num_params;
|
|
|
|
uint8 param_number[2];
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2007-02-24 16:34:37 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct GRFConfig : public GRFIdentifier {
|
2006-12-04 08:30:04 +00:00
|
|
|
char *filename;
|
2007-04-04 12:03:10 +00:00
|
|
|
char *full_path;
|
2006-12-04 08:30:04 +00:00
|
|
|
char *name;
|
|
|
|
char *info;
|
2007-02-24 16:34:37 +00:00
|
|
|
GRFError *error;
|
2006-12-04 08:30:04 +00:00
|
|
|
|
|
|
|
uint8 flags;
|
2007-03-06 19:33:28 +00:00
|
|
|
GRFStatus status;
|
2006-12-04 08:30:04 +00:00
|
|
|
uint32 param[0x80];
|
|
|
|
uint8 num_params;
|
|
|
|
|
|
|
|
struct GRFConfig *next;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2006-12-04 08:30:04 +00:00
|
|
|
|
|
|
|
/* First item in list of all scanned NewGRFs */
|
|
|
|
extern GRFConfig *_all_grfs;
|
|
|
|
|
|
|
|
/* First item in list of current GRF set up */
|
|
|
|
extern GRFConfig *_grfconfig;
|
|
|
|
|
|
|
|
/* First item in list of default GRF set up */
|
|
|
|
extern GRFConfig *_grfconfig_newgame;
|
|
|
|
|
2006-12-12 19:38:41 +00:00
|
|
|
/* First item in list of static GRF set up */
|
|
|
|
extern GRFConfig *_grfconfig_static;
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ScanNewGRFFiles();
|
2007-01-13 17:23:02 +00:00
|
|
|
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
|
2006-12-14 15:14:29 +00:00
|
|
|
GRFConfig *GetGRFConfig(uint32 grfid);
|
2006-12-20 20:43:52 +00:00
|
|
|
GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src);
|
2006-12-27 18:25:17 +00:00
|
|
|
void AppendStaticGRFConfigs(GRFConfig **dst);
|
2007-02-22 16:16:44 +00:00
|
|
|
void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el);
|
2006-12-20 20:43:52 +00:00
|
|
|
void ClearGRFConfig(GRFConfig **config);
|
2006-12-20 21:17:33 +00:00
|
|
|
void ClearGRFConfigList(GRFConfig **config);
|
2006-12-04 08:30:04 +00:00
|
|
|
void ResetGRFConfig(bool defaults);
|
2007-03-07 11:47:46 +00:00
|
|
|
GRFListCompatibility IsGoodGRFConfigList();
|
2006-12-12 19:38:41 +00:00
|
|
|
bool FillGRFDetails(GRFConfig *config, bool is_static);
|
2006-12-10 11:29:14 +00:00
|
|
|
char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last);
|
2006-12-04 08:30:04 +00:00
|
|
|
|
2007-03-21 03:06:21 +00:00
|
|
|
/* In newgrf_gui.cpp */
|
2006-12-21 10:29:16 +00:00
|
|
|
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config);
|
2006-12-04 14:27:54 +00:00
|
|
|
|
2006-12-31 11:12:49 +00:00
|
|
|
#ifdef ENABLE_NETWORK
|
2006-12-18 12:26:55 +00:00
|
|
|
/* For communication about GRFs over the network */
|
|
|
|
#define UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>"
|
|
|
|
char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
|
2006-12-31 11:12:49 +00:00
|
|
|
#endif /* ENABLE_NETWORK */
|
2006-12-18 12:26:55 +00:00
|
|
|
|
2006-12-04 08:30:04 +00:00
|
|
|
#endif /* NEWGRF_CONFIG_H */
|