|
@@ -104,24 +104,27 @@ struct GRFIdentifier {
|
|
|
{
|
|
|
if (this->grfid != grfid) return false;
|
|
|
if (md5sum == nullptr) return true;
|
|
|
return memcmp(md5sum, this->md5sum, sizeof(this->md5sum)) == 0;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/** Information about why GRF had problems during initialisation */
|
|
|
struct GRFError {
|
|
|
GRFError(StringID severity, StringID message = 0);
|
|
|
GRFError(const GRFError &error);
|
|
|
|
|
|
/* Remove the copy assignment, as the default implementation will not do the right thing. */
|
|
|
GRFError &operator=(GRFError &rhs) = delete;
|
|
|
|
|
|
std::string custom_message; ///< Custom message (if present)
|
|
|
std::string data; ///< Additional data for message and custom_message
|
|
|
StringID message; ///< Default message
|
|
|
StringID severity; ///< Info / Warning / Error / Fatal
|
|
|
uint32 param_value[2]; ///< Values of GRF parameters to show for message and custom_message
|
|
|
};
|
|
|
|
|
|
/** The possible types of a newgrf parameter. */
|
|
|
enum GRFParameterType {
|
|
|
PTYPE_UINT_ENUM, ///< The parameter allows a range of numbers, each of which can have a special name
|
|
|
PTYPE_BOOL, ///< The parameter is either 0 or 1
|
|
|
PTYPE_END, ///< Invalid parameter type
|
|
@@ -145,24 +148,27 @@ struct GRFParameterInfo {
|
|
|
|
|
|
uint32 GetValue(struct GRFConfig *config) const;
|
|
|
void SetValue(struct GRFConfig *config, uint32 value);
|
|
|
void Finalize();
|
|
|
};
|
|
|
|
|
|
/** Information about GRF, used in the game and (part of it) in savegames */
|
|
|
struct GRFConfig : ZeroedMemoryAllocator {
|
|
|
GRFConfig(const char *filename = nullptr);
|
|
|
GRFConfig(const GRFConfig &config);
|
|
|
~GRFConfig();
|
|
|
|
|
|
/* Remove the copy assignment, as the default implementation will not do the right thing. */
|
|
|
GRFConfig &operator=(GRFConfig &rhs) = delete;
|
|
|
|
|
|
GRFIdentifier ident; ///< grfid and md5sum to uniquely identify newgrfs
|
|
|
uint8 original_md5sum[16]; ///< MD5 checksum of original file if only a 'compatible' file was loaded
|
|
|
char *filename; ///< Filename - either with or without full path
|
|
|
GRFTextWrapper name; ///< NOSAVE: GRF name (Action 0x08)
|
|
|
GRFTextWrapper info; ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
|
|
|
GRFTextWrapper url; ///< NOSAVE: URL belonging to this GRF.
|
|
|
GRFError *error; ///< NOSAVE: Error/Warning during GRF loading (Action 0x0B)
|
|
|
|
|
|
uint32 version; ///< NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown
|
|
|
uint32 min_loadable_version; ///< NOSAVE: Minimum compatible version a NewGRF can define
|
|
|
uint8 flags; ///< NOSAVE: GCF_Flags, bitset
|
|
|
GRFStatus status; ///< NOSAVE: GRFStatus, enum
|