OpenTTD Source: src/newgrf_config.h Source File

OpenTTD Source 15.0-RC2

newgrf_config.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef NEWGRF_CONFIG_H
11#define NEWGRF_CONFIG_H
12
13#include "strings_type.h"
14#include "fileio_type.h"
15#include "textfile_type.h"
16#include "newgrf_text.h"
17#include "3rdparty/md5/md5.h"
18
20 enum GRFConfigFlag : uint8_t {
21 System,
22 Unsafe,
23 Static,
24 Compatible,
25 Copy,
26 InitOnly,
27 Reserved,
28 Invalid,
29};
30using GRFConfigFlags = EnumBitSet<GRFConfigFlag, uint8_t>;
31
33 enum GRFStatus : uint8_t {
34 GCS_UNKNOWN,
35 GCS_DISABLED,
36 GCS_NOT_FOUND,
37 GCS_INITIALISED,
38 GCS_ACTIVATED,
39};
40
42 enum class GRFBug : uint8_t {
43 VehLength = 0,
44 VehRefit = 1,
45 VehPoweredWagon = 2,
46 UnknownCbResult = 3,
47 VehCapacity = 4,
48};
49using GRFBugs = EnumBitSet<GRFBug, uint8_t>;
50
52 enum GRFListCompatibility : uint8_t {
53 GLC_ALL_GOOD,
54 GLC_COMPATIBLE,
55 GLC_NOT_FOUND,
56};
57
59 enum GRFPalette : uint8_t {
60 GRFP_USE_BIT = 0,
61 GRFP_GRF_OFFSET = 2,
62 GRFP_GRF_SIZE = 2,
63 GRFP_BLT_OFFSET = 4,
64 GRFP_BLT_SIZE = 1,
65
66 GRFP_USE_DOS = 0x0,
67 GRFP_USE_WINDOWS = 0x1,
68 GRFP_USE_MASK = 0x1,
69
70 GRFP_GRF_UNSET = 0x0 << GRFP_GRF_OFFSET,
71 GRFP_GRF_DOS = 0x1 << GRFP_GRF_OFFSET,
72 GRFP_GRF_WINDOWS = 0x2 << GRFP_GRF_OFFSET,
73 GRFP_GRF_ANY = GRFP_GRF_DOS | GRFP_GRF_WINDOWS,
74 GRFP_GRF_MASK = GRFP_GRF_ANY,
75
76 GRFP_BLT_UNSET = 0x0 << GRFP_BLT_OFFSET,
77 GRFP_BLT_32BPP = 0x1 << GRFP_BLT_OFFSET,
78 GRFP_BLT_MASK = GRFP_BLT_32BPP,
79};
80
81
83 struct GRFIdentifier {
84 uint32_t grfid;
85 MD5Hash md5sum;
86
87 GRFIdentifier() = default;
88 GRFIdentifier(const GRFIdentifier &other) = default;
89 GRFIdentifier(GRFIdentifier &&other) = default;
90 GRFIdentifier(uint32_t grfid, const MD5Hash &md5sum) : grfid(grfid), md5sum(md5sum) {}
91
92 GRFIdentifier& operator =(const GRFIdentifier &other) = default;
93
100 inline bool HasGrfIdentifier(uint32_t grfid, const MD5Hash *md5sum) const
101 {
102 if (this->grfid != grfid) return false;
103 if (md5sum == nullptr) return true;
104 return *md5sum == this->md5sum;
105 }
106};
107
109 struct GRFError {
110 GRFError(StringID severity, uint32_t nfo_line, StringID message = {})
111 : message(message), severity(severity), nfo_line(nfo_line) {}
112
113 std::string custom_message{};
114 std::string data{};
115 StringID message{};
116 StringID severity{};
117 uint32_t nfo_line;
118 std::array<uint32_t, 2> param_value{};
119};
120
122 enum GRFParameterType : uint8_t {
123 PTYPE_UINT_ENUM,
124 PTYPE_BOOL,
125 PTYPE_END,
126};
127
129 struct GRFParameterInfo {
134 explicit GRFParameterInfo(uint nr) : param_nr(nr) {}
135
136 GRFTextList name = {};
137 GRFTextList desc = {};
138
139 uint32_t min_value = 0;
140 uint32_t max_value = UINT32_MAX;
141 uint32_t def_value = 0;
142
143 GRFParameterType type = PTYPE_UINT_ENUM;
144
145 uint8_t param_nr;
146 uint8_t first_bit = 0;
147 uint8_t num_bit = 32;
148
149 bool complete_labels = false;
150
151 using ValueName = std::pair<uint32_t, GRFTextList>;
152 std::vector<ValueName> value_names;
153
154 void Finalize();
155};
156
158 struct GRFConfig {
159 static constexpr uint8_t MAX_NUM_PARAMS = 0x80;
160
161 GRFConfig() = default;
162 GRFConfig(const std::string &filename) : filename(filename) {}
163 GRFConfig(const GRFConfig &config);
164
165 /* Remove the copy assignment, as the default implementation will not do the right thing. */
166 GRFConfig &operator=(GRFConfig &rhs) = delete;
167
168 GRFIdentifier ident{};
169 MD5Hash original_md5sum{};
170 std::string filename{};
171 GRFTextWrapper name{};
172 GRFTextWrapper info{};
173 GRFTextWrapper url{};
174 std::vector<GRFError> errors;
175
176 uint32_t version = 0;
177 uint32_t min_loadable_version = 0;
178 GRFConfigFlags flags = {};
179 GRFStatus status = GCS_UNKNOWN;
180 GRFBugs grf_bugs = {};
181 uint8_t num_valid_params = MAX_NUM_PARAMS;
182 uint8_t palette = 0;
183 bool has_param_defaults = false;
184 std::vector<std::optional<GRFParameterInfo>> param_info;
185 std::vector<uint32_t> param;
186
187 bool IsCompatible(uint32_t old_version) const;
188 void SetParams(std::span<const uint32_t> pars);
189 void CopyParams(const GRFConfig &src);
190
191 uint32_t GetValue(const GRFParameterInfo &info) const;
192 void SetValue(const GRFParameterInfo &info, uint32_t value);
193
194 std::optional<std::string> GetTextfile(TextfileType type) const;
195 std::string GetName() const;
196 std::optional<std::string> GetDescription() const;
197 std::optional<std::string> GetURL() const;
198
199 void SetParameterDefaults();
200 void SetSuitablePalette();
201 void FinalizeParameterInfo();
202};
203
204using GRFConfigList = std::vector<std::unique_ptr<GRFConfig>>;
205
207 enum FindGRFConfigMode : uint8_t {
208 FGCM_EXACT,
209 FGCM_COMPATIBLE,
210 FGCM_NEWEST,
211 FGCM_NEWEST_VALID,
212 FGCM_ANY,
213};
214
215extern GRFConfigList _all_grfs;
216extern GRFConfigList _grfconfig;
217extern GRFConfigList _grfconfig_newgame;
218extern GRFConfigList _grfconfig_static;
219extern uint _missing_extra_graphics;
220
222 struct NewGRFScanCallback {
224 virtual ~NewGRFScanCallback() = default;
226 virtual void OnNewGRFsScanned() = 0;
227};
228
229size_t GRFGetSizeOfDataSection(FileHandle &f);
230
231void ScanNewGRFFiles(NewGRFScanCallback *callback);
232const GRFConfig *FindGRFConfig(uint32_t grfid, FindGRFConfigMode mode, const MD5Hash *md5sum = nullptr, uint32_t desired_version = 0);
233 GRFConfig *GetGRFConfig(uint32_t grfid, uint32_t mask = 0xFFFFFFFF);
234void CopyGRFConfigList(GRFConfigList &dst, const GRFConfigList &src, bool init_only);
235void AppendStaticGRFConfigs(GRFConfigList &dst);
236void AppendToGRFConfigList(GRFConfigList &dst, std::unique_ptr<GRFConfig> &&el);
237void ClearGRFConfigList(GRFConfigList &config);
238void ResetGRFConfig(bool defaults);
239 GRFListCompatibility IsGoodGRFConfigList(GRFConfigList &grfconfig);
240bool FillGRFDetails(GRFConfig &config, bool is_static, Subdirectory subdir = NEWGRF_DIR);
241std::string GRFBuildParamList(const GRFConfig &c);
242
243/* In newgrf_gui.cpp */
244void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfigList &config);
245void OpenGRFParameterWindow(bool is_baseset, GRFConfig &c, bool editable);
246
247void UpdateNewGRFScanStatus(uint num, std::string &&name);
248void UpdateNewGRFConfigPalette(int32_t new_value = 0);
249
250#endif /* NEWGRF_CONFIG_H */
EnumBitSet< GRFConfigFlag, uint8_t >
FileHandle
Definition fileio_type.h:132
fileio_type.h
Types for Standard In/Out file operations.
Subdirectory
Subdirectory
The different kinds of subdirectories OpenTTD uses.
Definition fileio_type.h:88
NEWGRF_DIR
@ NEWGRF_DIR
Subdirectory for all NewGRFs.
Definition fileio_type.h:97
UpdateNewGRFConfigPalette
void UpdateNewGRFConfigPalette(int32_t new_value=0)
Update the palettes of the graphics from the config file.
Definition newgrf_config.cpp:215
_grfconfig
GRFConfigList _grfconfig
First item in list of current GRF set up.
Definition newgrf_config.cpp:154
GRFListCompatibility
GRFListCompatibility
Status of post-gameload GRF compatibility check.
Definition newgrf_config.h:52
GLC_COMPATIBLE
@ GLC_COMPATIBLE
Compatible (eg. the same ID, but different checksum) GRF found in at least one case.
Definition newgrf_config.h:54
GLC_ALL_GOOD
@ GLC_ALL_GOOD
All GRF needed by game are present.
Definition newgrf_config.h:53
GLC_NOT_FOUND
@ GLC_NOT_FOUND
At least one GRF couldn't be found (higher priority than GLC_COMPATIBLE)
Definition newgrf_config.h:55
_grfconfig_static
GRFConfigList _grfconfig_static
First item in list of static GRF set up.
Definition newgrf_config.cpp:156
CopyGRFConfigList
void CopyGRFConfigList(GRFConfigList &dst, const GRFConfigList &src, bool init_only)
Copy a GRF Config list.
Definition newgrf_config.cpp:353
GRFStatus
GRFStatus
Status of GRF.
Definition newgrf_config.h:33
GCS_INITIALISED
@ GCS_INITIALISED
GRF file has been initialised.
Definition newgrf_config.h:37
GCS_DISABLED
@ GCS_DISABLED
GRF file is disabled.
Definition newgrf_config.h:35
GCS_NOT_FOUND
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
Definition newgrf_config.h:36
GCS_UNKNOWN
@ GCS_UNKNOWN
The status of this grf file is unknown.
Definition newgrf_config.h:34
GCS_ACTIVATED
@ GCS_ACTIVATED
GRF file has been activated.
Definition newgrf_config.h:38
GetGRFConfig
GRFConfig * GetGRFConfig(uint32_t grfid, uint32_t mask=0xFFFFFFFF)
Retrieve a NewGRF from the current config by its grfid.
Definition newgrf_config.cpp:622
IsGoodGRFConfigList
GRFListCompatibility IsGoodGRFConfigList(GRFConfigList &grfconfig)
Check if all GRFs in the GRF config from a savegame can be loaded.
Definition newgrf_config.cpp:425
GRFBuildParamList
std::string GRFBuildParamList(const GRFConfig &c)
Build a string containing space separated parameter values, and terminate.
Definition newgrf_config.cpp:632
GRFConfigFlag
GRFConfigFlag
GRF config bit flags.
Definition newgrf_config.h:20
InitOnly
@ InitOnly
GRF file is processed up to GLS_INIT.
Definition newgrf_config.h:26
Reserved
@ Reserved
GRF file passed GLS_RESERVE stage.
Definition newgrf_config.h:27
System
@ System
GRF file is an openttd-internal system grf.
Definition newgrf_config.h:21
Copy
@ Copy
The data is copied from a grf in _all_grfs.
Definition newgrf_config.h:25
Compatible
@ Compatible
GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
Definition newgrf_config.h:24
Static
@ Static
GRF file is used statically (can be used in any MP game)
Definition newgrf_config.h:23
Unsafe
@ Unsafe
GRF file is unsafe for static usage.
Definition newgrf_config.h:22
Invalid
@ Invalid
GRF is unusable with this version of OpenTTD.
Definition newgrf_config.h:28
_missing_extra_graphics
uint _missing_extra_graphics
Number of sprites provided by the fallback extra GRF, i.e. missing in the baseset.
Definition newgrf_config.cpp:157
UpdateNewGRFScanStatus
void UpdateNewGRFScanStatus(uint num, std::string &&name)
Update the NewGRF scan status.
Definition newgrf_gui.cpp:2218
ShowNewGRFSettings
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfigList &config)
Setup the NewGRF gui.
Definition newgrf_gui.cpp:1966
ResetGRFConfig
void ResetGRFConfig(bool defaults)
Reset the current GRF Config to either blank or newgame settings.
Definition newgrf_config.cpp:407
GRFBug
GRFBug
Encountered GRF bugs.
Definition newgrf_config.h:42
GRFBug::VehRefit
@ VehRefit
Articulated vehicles carry different cargoes resp. are differently refittable than specified in purch...
GRFBug::UnknownCbResult
@ UnknownCbResult
A callback returned an unknown/invalid result.
GRFBug::VehCapacity
@ VehCapacity
Capacity of vehicle changes when not refitting or arranging.
GRFBug::VehPoweredWagon
@ VehPoweredWagon
Powered wagon changed poweredness state when not inside a depot.
GRFBug::VehLength
@ VehLength
Length of rail vehicle changes when not inside a depot.
_grfconfig_newgame
GRFConfigList _grfconfig_newgame
First item in list of default GRF set up.
Definition newgrf_config.cpp:155
_all_grfs
GRFConfigList _all_grfs
First item in list of all scanned NewGRFs.
Definition newgrf_config.cpp:153
FindGRFConfig
const GRFConfig * FindGRFConfig(uint32_t grfid, FindGRFConfigMode mode, const MD5Hash *md5sum=nullptr, uint32_t desired_version=0)
Find a NewGRF in the scanned list.
Definition newgrf_config.cpp:596
FillGRFDetails
bool FillGRFDetails(GRFConfig &config, bool is_static, Subdirectory subdir=NEWGRF_DIR)
Find the GRFID of a given grf, and calculate its md5sum.
Definition newgrf_config.cpp:292
AppendStaticGRFConfigs
void AppendStaticGRFConfigs(GRFConfigList &dst)
Appends the static GRFs to a list of GRFs.
Definition newgrf_config.cpp:388
GRFParameterType
GRFParameterType
The possible types of a newgrf parameter.
Definition newgrf_config.h:122
PTYPE_UINT_ENUM
@ PTYPE_UINT_ENUM
The parameter allows a range of numbers, each of which can have a special name.
Definition newgrf_config.h:123
PTYPE_BOOL
@ PTYPE_BOOL
The parameter is either 0 or 1.
Definition newgrf_config.h:124
PTYPE_END
@ PTYPE_END
Invalid parameter type.
Definition newgrf_config.h:125
ScanNewGRFFiles
void ScanNewGRFFiles(NewGRFScanCallback *callback)
Scan for all NewGRFs.
Definition newgrf_config.cpp:578
FindGRFConfigMode
FindGRFConfigMode
Method to find GRFs using FindGRFConfig.
Definition newgrf_config.h:207
FGCM_NEWEST
@ FGCM_NEWEST
Find newest Grf.
Definition newgrf_config.h:210
FGCM_ANY
@ FGCM_ANY
Use first found.
Definition newgrf_config.h:212
FGCM_NEWEST_VALID
@ FGCM_NEWEST_VALID
Find newest Grf, ignoring Grfs with GRFConfigFlag::Invalid set.
Definition newgrf_config.h:211
FGCM_EXACT
@ FGCM_EXACT
Only find Grfs matching md5sum.
Definition newgrf_config.h:208
FGCM_COMPATIBLE
@ FGCM_COMPATIBLE
Find best compatible Grf wrt. desired_version.
Definition newgrf_config.h:209
GRFGetSizeOfDataSection
size_t GRFGetSizeOfDataSection(FileHandle &f)
Get the data section size of a GRF.
Definition newgrf_config.cpp:227
GRFPalette
GRFPalette
Information that can/has to be stored about a GRF's palette.
Definition newgrf_config.h:59
GRFP_GRF_UNSET
@ GRFP_GRF_UNSET
The NewGRF provided no information.
Definition newgrf_config.h:70
GRFP_BLT_UNSET
@ GRFP_BLT_UNSET
The NewGRF provided no information or doesn't care about a 32 bpp blitter.
Definition newgrf_config.h:76
GRFP_USE_DOS
@ GRFP_USE_DOS
The palette state is set to use the DOS palette.
Definition newgrf_config.h:66
GRFP_GRF_WINDOWS
@ GRFP_GRF_WINDOWS
The NewGRF says the Windows palette can be used.
Definition newgrf_config.h:72
GRFP_USE_WINDOWS
@ GRFP_USE_WINDOWS
The palette state is set to use the Windows palette.
Definition newgrf_config.h:67
GRFP_GRF_DOS
@ GRFP_GRF_DOS
The NewGRF says the DOS palette can be used.
Definition newgrf_config.h:71
GRFP_GRF_ANY
@ GRFP_GRF_ANY
The NewGRF says any palette can be used.
Definition newgrf_config.h:73
GRFP_BLT_MASK
@ GRFP_BLT_MASK
Bitmask to only get the blitter information.
Definition newgrf_config.h:78
GRFP_BLT_32BPP
@ GRFP_BLT_32BPP
The NewGRF prefers a 32 bpp blitter.
Definition newgrf_config.h:77
GRFP_BLT_OFFSET
@ GRFP_BLT_OFFSET
The offset of the GRFP_BLT data.
Definition newgrf_config.h:63
GRFP_GRF_SIZE
@ GRFP_GRF_SIZE
The size of the GRFP_GRF data.
Definition newgrf_config.h:62
GRFP_USE_BIT
@ GRFP_USE_BIT
The bit used for storing the palette to use.
Definition newgrf_config.h:60
GRFP_USE_MASK
@ GRFP_USE_MASK
Bitmask to get only the use palette use states.
Definition newgrf_config.h:68
GRFP_BLT_SIZE
@ GRFP_BLT_SIZE
The size of the GRFP_BLT data.
Definition newgrf_config.h:64
GRFP_GRF_OFFSET
@ GRFP_GRF_OFFSET
The offset of the GRFP_GRF data.
Definition newgrf_config.h:61
GRFP_GRF_MASK
@ GRFP_GRF_MASK
Bitmask to get only the NewGRF supplied information.
Definition newgrf_config.h:74
AppendToGRFConfigList
void AppendToGRFConfigList(GRFConfigList &dst, std::unique_ptr< GRFConfig > &&el)
Appends an element to a list of GRFs.
Definition newgrf_config.cpp:399
ClearGRFConfigList
void ClearGRFConfigList(GRFConfigList &config)
Clear a GRF Config list, freeing all nodes.
Definition newgrf_config.cpp:324
newgrf_text.h
Header of Action 04 "universal holder" structure and functions.
GRFTextWrapper
std::shared_ptr< GRFTextList > GRFTextWrapper
Reference counted wrapper around a GRFText pointer.
Definition newgrf_text_type.h:32
GRFTextList
std::vector< GRFText > GRFTextList
A GRF text with a list of translations.
Definition newgrf_text_type.h:30
strings_type.h
Types related to strings.
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition strings_type.h:19
GRFConfig
Information about GRF, used in the game and (part of it) in savegames.
Definition newgrf_config.h:158
GRFConfig::original_md5sum
MD5Hash original_md5sum
MD5 checksum of original file if only a 'compatible' file was loaded.
Definition newgrf_config.h:169
GRFConfig::SetParameterDefaults
void SetParameterDefaults()
Set the default value for all parameters as specified by action14.
Definition newgrf_config.cpp:114
GRFConfig::url
GRFTextWrapper url
NOSAVE: URL belonging to this GRF.
Definition newgrf_config.h:173
GRFConfig::palette
uint8_t palette
GRFPalette, bitset.
Definition newgrf_config.h:182
GRFConfig::info
GRFTextWrapper info
NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
Definition newgrf_config.h:172
GRFConfig::param_info
std::vector< std::optional< GRFParameterInfo > > param_info
NOSAVE: extra information about the parameters.
Definition newgrf_config.h:184
GRFConfig::errors
std::vector< GRFError > errors
NOSAVE: Error/Warning during GRF loading (Action 0x0B)
Definition newgrf_config.h:174
GRFConfig::version
uint32_t version
NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown.
Definition newgrf_config.h:176
GRFConfig::param
std::vector< uint32_t > param
GRF parameters.
Definition newgrf_config.h:185
GRFConfig::FinalizeParameterInfo
void FinalizeParameterInfo()
Finalize Action 14 info after file scan is finished.
Definition newgrf_config.cpp:145
GRFConfig::has_param_defaults
bool has_param_defaults
NOSAVE: did this newgrf specify any defaults for it's parameters.
Definition newgrf_config.h:183
GRFConfig::name
GRFTextWrapper name
NOSAVE: GRF name (Action 0x08)
Definition newgrf_config.h:171
GRFConfig::grf_bugs
GRFBugs grf_bugs
NOSAVE: bugs in this GRF in this run,.
Definition newgrf_config.h:180
GRFConfig::GetURL
std::optional< std::string > GetURL() const
Get the grf url.
Definition newgrf_config.cpp:106
GRFConfig::status
GRFStatus status
NOSAVE: GRFStatus, enum.
Definition newgrf_config.h:179
GRFConfig::SetValue
void SetValue(const GRFParameterInfo &info, uint32_t value)
Set the value of the given user-changeable parameter.
Definition newgrf_config.cpp:180
GRFConfig::IsCompatible
bool IsCompatible(uint32_t old_version) const
Return whether this NewGRF can replace an older version of the same NewGRF.
Definition newgrf_config.cpp:66
GRFConfig::CopyParams
void CopyParams(const GRFConfig &src)
Copy the parameter information from the src config.
Definition newgrf_config.cpp:75
GRFConfig::GetTextfile
std::optional< std::string > GetTextfile(TextfileType type) const
Search a textfile file next to this NewGRF.
Definition newgrf_config.cpp:647
GRFConfig::flags
GRFConfigFlags flags
NOSAVE: GCF_Flags, bitset.
Definition newgrf_config.h:178
GRFConfig::num_valid_params
uint8_t num_valid_params
NOSAVE: Number of valid parameters (action 0x14)
Definition newgrf_config.h:181
GRFConfig::filename
std::string filename
Filename - either with or without full path.
Definition newgrf_config.h:170
GRFConfig::ident
GRFIdentifier ident
grfid and md5sum to uniquely identify newgrfs
Definition newgrf_config.h:168
GRFConfig::SetSuitablePalette
void SetSuitablePalette()
Set the palette of this GRFConfig to something suitable.
Definition newgrf_config.cpp:131
GRFConfig::min_loadable_version
uint32_t min_loadable_version
NOSAVE: Minimum compatible version a NewGRF can define.
Definition newgrf_config.h:177
GRFConfig::GetName
std::string GetName() const
Get the name of this grf.
Definition newgrf_config.cpp:85
GRFConfig::GetDescription
std::optional< std::string > GetDescription() const
Get the grf info.
Definition newgrf_config.cpp:95
GRFConfig::GetValue
uint32_t GetValue(const GRFParameterInfo &info) const
Get the value of the given user-changeable parameter.
Definition newgrf_config.cpp:164
GRFError
Information about why GRF had problems during initialisation.
Definition newgrf_config.h:109
GRFError::severity
StringID severity
Info / Warning / Error / Fatal.
Definition newgrf_config.h:116
GRFError::param_value
std::array< uint32_t, 2 > param_value
Values of GRF parameters to show for message and custom_message.
Definition newgrf_config.h:118
GRFError::nfo_line
uint32_t nfo_line
Line within NewGRF of error.
Definition newgrf_config.h:117
GRFError::message
StringID message
Default message.
Definition newgrf_config.h:115
GRFError::custom_message
std::string custom_message
Custom message (if present)
Definition newgrf_config.h:113
GRFError::data
std::string data
Additional data for message and custom_message.
Definition newgrf_config.h:114
GRFIdentifier
Basic data to distinguish a GRF.
Definition newgrf_config.h:83
GRFIdentifier::HasGrfIdentifier
bool HasGrfIdentifier(uint32_t grfid, const MD5Hash *md5sum) const
Does the identification match the provided values?
Definition newgrf_config.h:100
GRFIdentifier::grfid
uint32_t grfid
GRF ID (defined by Action 0x08)
Definition newgrf_config.h:84
GRFIdentifier::md5sum
MD5Hash md5sum
MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
Definition newgrf_config.h:85
GRFParameterInfo
Information about one grf parameter.
Definition newgrf_config.h:129
GRFParameterInfo::complete_labels
bool complete_labels
True if all values have a label.
Definition newgrf_config.h:149
GRFParameterInfo::param_nr
uint8_t param_nr
GRF parameter to store content in.
Definition newgrf_config.h:145
GRFParameterInfo::min_value
uint32_t min_value
The minimal value this parameter can have.
Definition newgrf_config.h:139
GRFParameterInfo::num_bit
uint8_t num_bit
Number of bits to use for this parameter.
Definition newgrf_config.h:147
GRFParameterInfo::first_bit
uint8_t first_bit
First bit to use in the GRF parameter.
Definition newgrf_config.h:146
GRFParameterInfo::max_value
uint32_t max_value
The maximal value of this parameter.
Definition newgrf_config.h:140
GRFParameterInfo::type
GRFParameterType type
The type of this parameter.
Definition newgrf_config.h:143
GRFParameterInfo::value_names
std::vector< ValueName > value_names
Names for each value.
Definition newgrf_config.h:152
GRFParameterInfo::Finalize
void Finalize()
Finalize Action 14 info after file scan is finished.
Definition newgrf_config.cpp:200
GRFParameterInfo::GRFParameterInfo
GRFParameterInfo(uint nr)
Create a new empty GRFParameterInfo object.
Definition newgrf_config.h:134
GRFParameterInfo::def_value
uint32_t def_value
Default value of this parameter.
Definition newgrf_config.h:141
GRFParameterInfo::name
GRFTextList name
The name of this parameter.
Definition newgrf_config.h:136
GRFParameterInfo::desc
GRFTextList desc
The description of this parameter.
Definition newgrf_config.h:137
NewGRFScanCallback
Callback for NewGRF scanning.
Definition newgrf_config.h:222
NewGRFScanCallback::~NewGRFScanCallback
virtual ~NewGRFScanCallback()=default
Make sure the right destructor gets called.
NewGRFScanCallback::OnNewGRFsScanned
virtual void OnNewGRFsScanned()=0
Called whenever the NewGRF scan completed.
textfile_type.h
Types related to textfiles.
TextfileType
TextfileType
Additional text files accompanying Tar archives.
Definition textfile_type.h:14