OpenTTD Source: src/newgrf_commons.h Source File

OpenTTD Source 14.1

newgrf_commons.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 <http://www.gnu.org/licenses/>.
6 */
7
13 #ifndef NEWGRF_COMMONS_H
14 #define NEWGRF_COMMONS_H
15
16 #include "sprite.h"
17 #include "core/alloc_type.hpp"
18 #include "command_type.h"
19 #include "direction_type.h"
20 #include "company_type.h"
21
23 enum TileContext {
24 TCX_NORMAL,
25 TCX_UPPER_HALFTILE,
26 TCX_ON_BRIDGE,
27 };
28
32 enum TileLayoutFlags {
33 TLF_NOTHING = 0x00,
34
35 TLF_DODRAW = 0x01,
36 TLF_SPRITE = 0x02,
37 TLF_PALETTE = 0x04,
38 TLF_CUSTOM_PALETTE = 0x08,
39
40 TLF_BB_XY_OFFSET = 0x10,
41 TLF_BB_Z_OFFSET = 0x20,
42
43 TLF_CHILD_X_OFFSET = 0x10,
44 TLF_CHILD_Y_OFFSET = 0x20,
45
46 TLF_SPRITE_VAR10 = 0x40,
47 TLF_PALETTE_VAR10 = 0x80,
48
49 TLF_KNOWN_FLAGS = 0xFF,
50
52 TLF_DRAWING_FLAGS = ~TLF_CUSTOM_PALETTE,
53
55 TLF_NON_GROUND_FLAGS = TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET,
56
58 TLF_VAR10_FLAGS = TLF_SPRITE_VAR10 | TLF_PALETTE_VAR10,
59
61 TLF_SPRITE_REG_FLAGS = TLF_DODRAW | TLF_SPRITE | TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET,
62
64 TLF_PALETTE_REG_FLAGS = TLF_PALETTE,
65 };
66 DECLARE_ENUM_AS_BIT_SET(TileLayoutFlags)
67
68
74 inline uint GetConstructionStageOffset(uint construction_stage, uint num_sprites)
75 {
76 assert(num_sprites > 0);
77 if (num_sprites > 4) num_sprites = 4;
78 switch (construction_stage) {
79 case 0: return 0;
80 case 1: return num_sprites > 2 ? 1 : 0;
81 case 2: return num_sprites > 2 ? num_sprites - 2 : 0;
82 case 3: return num_sprites - 1;
83 default: NOT_REACHED();
84 }
85 }
86
90 struct TileLayoutRegisters {
91 TileLayoutFlags flags;
92 uint8_t dodraw;
93 uint8_t sprite;
94 uint8_t palette;
95 uint16_t max_sprite_offset;
96 uint16_t max_palette_offset;
97 union {
98 uint8_t parent[3];
99 uint8_t child[2];
100 } delta;
101 uint8_t sprite_var10;
102 uint8_t palette_var10;
103 };
104
105 static const uint TLR_MAX_VAR10 = 7;
106
112 struct NewGRFSpriteLayout : ZeroedMemoryAllocator, DrawTileSprites {
113 const TileLayoutRegisters *registers;
114
119 uint consistent_max_offset;
120
121 void Allocate(uint num_sprites);
122 void AllocateRegisters();
123 void Clone(const DrawTileSeqStruct *source);
124 void Clone(const NewGRFSpriteLayout *source);
125
130 void Clone(const DrawTileSprites *source)
131 {
132 assert(source != nullptr && this != source);
133 this->ground = source->ground;
134 this->Clone(source->seq);
135 }
136
137 virtual ~NewGRFSpriteLayout()
138 {
139 free(this->seq);
140 free(this->registers);
141 }
142
149 bool NeedsPreprocessing() const
150 {
151 return this->registers != nullptr;
152 }
153
154 uint32_t PrepareLayout(uint32_t orig_offset, uint32_t newgrf_ground_offset, uint32_t newgrf_offset, uint constr_stage, bool separate_ground) const;
155 void ProcessRegisters(uint8_t resolved_var10, uint32_t resolved_sprite, bool separate_ground) const;
156
162 const DrawTileSeqStruct *GetLayout(PalSpriteID *ground) const
163 {
164 DrawTileSeqStruct *front = result_seq.data();
165 *ground = front->image;
166 return front + 1;
167 }
168
169 private:
170 static std::vector<DrawTileSeqStruct> result_seq;
171 };
172
185 struct EntityIDMapping {
186 uint32_t grfid;
187 uint16_t entity_id;
188 uint16_t substitute_id;
189 };
190
191 class OverrideManagerBase {
192 protected:
193 std::vector<uint16_t> entity_overrides;
194 std::vector<uint32_t> grfid_overrides;
195
196 uint16_t max_offset;
197 uint16_t max_entities;
198
199 uint16_t invalid_id;
200 virtual bool CheckValidNewID([[maybe_unused]] uint16_t testid) { return true; }
201
202 public:
203 std::vector<EntityIDMapping> mappings;
204
205 OverrideManagerBase(uint16_t offset, uint16_t maximum, uint16_t invalid);
206 virtual ~OverrideManagerBase() = default;
207
208 void ResetOverride();
209 void ResetMapping();
210
211 void Add(uint16_t local_id, uint32_t grfid, uint entity_type);
212 virtual uint16_t AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id);
213
214 uint32_t GetGRFID(uint16_t entity_id) const;
215 uint16_t GetSubstituteID(uint16_t entity_id) const;
216 virtual uint16_t GetID(uint16_t grf_local_id, uint32_t grfid) const;
217
218 inline uint16_t GetMaxMapping() const { return this->max_entities; }
219 inline uint16_t GetMaxOffset() const { return this->max_offset; }
220 };
221
222
223 struct HouseSpec;
224 class HouseOverrideManager : public OverrideManagerBase {
225 public:
226 HouseOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
227 OverrideManagerBase(offset, maximum, invalid) {}
228
229 void SetEntitySpec(const HouseSpec *hs);
230 };
231
232
233 struct IndustrySpec;
234 class IndustryOverrideManager : public OverrideManagerBase {
235 public:
236 IndustryOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
237 OverrideManagerBase(offset, maximum, invalid) {}
238
239 uint16_t AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id) override;
240 uint16_t GetID(uint16_t grf_local_id, uint32_t grfid) const override;
241
242 void SetEntitySpec(IndustrySpec *inds);
243 };
244
245
246 struct IndustryTileSpec;
247 class IndustryTileOverrideManager : public OverrideManagerBase {
248 protected:
249 bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; }
250 public:
251 IndustryTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
252 OverrideManagerBase(offset, maximum, invalid) {}
253
254 void SetEntitySpec(const IndustryTileSpec *indts);
255 };
256
257 struct AirportSpec;
258 class AirportOverrideManager : public OverrideManagerBase {
259 public:
260 AirportOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
261 OverrideManagerBase(offset, maximum, invalid) {}
262
263 void SetEntitySpec(AirportSpec *inds);
264 };
265
266 struct AirportTileSpec;
267 class AirportTileOverrideManager : public OverrideManagerBase {
268 protected:
269 bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; }
270 public:
271 AirportTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
272 OverrideManagerBase(offset, maximum, invalid) {}
273
274 void SetEntitySpec(const AirportTileSpec *ats);
275 };
276
277 struct ObjectSpec;
278 class ObjectOverrideManager : public OverrideManagerBase {
279 protected:
280 bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; }
281 public:
282 ObjectOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
283 OverrideManagerBase(offset, maximum, invalid) {}
284
285 void SetEntitySpec(ObjectSpec *spec);
286 };
287
288 extern HouseOverrideManager _house_mngr;
289 extern IndustryOverrideManager _industry_mngr;
290 extern IndustryTileOverrideManager _industile_mngr;
291 extern AirportOverrideManager _airport_mngr;
292 extern AirportTileOverrideManager _airporttile_mngr;
293 extern ObjectOverrideManager _object_mngr;
294
295 uint32_t GetTerrainType(TileIndex tile, TileContext context = TCX_NORMAL);
296 TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets = true, Axis axis = INVALID_AXIS);
297 uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8);
298 uint32_t GetCompanyInfo(CompanyID owner, const struct Livery *l = nullptr);
299 CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, const GRFFile *grffile, StringID default_error);
300
301 void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res);
302 bool ConvertBooleanCallback(const struct GRFFile *grffile, uint16_t cbid, uint16_t cb_res);
303 bool Convert8bitBooleanCallback(const struct GRFFile *grffile, uint16_t cbid, uint16_t cb_res);
304
309 template <size_t Tcnt>
310 struct GRFFilePropsBase {
311 GRFFilePropsBase() : local_id(0), grffile(nullptr)
312 {
313 /* The lack of some compilers to provide default constructors complying to the specs
314 * requires us to zero the stuff ourself. */
315 memset(spritegroup, 0, sizeof(spritegroup));
316 }
317
318 uint16_t local_id;
319 const struct GRFFile *grffile;
320 const struct SpriteGroup *spritegroup[Tcnt];
321 };
322
324 struct GRFFileProps : GRFFilePropsBase<1> {
326 GRFFileProps(uint16_t subst_id = 0) :
327 GRFFilePropsBase<1>(), subst_id(subst_id), override(subst_id)
328 {
329 }
330
331 uint16_t subst_id;
332 uint16_t override;
333 };
334
335 #endif /* NEWGRF_COMMONS_H */
TCX_UPPER_HALFTILE
@ TCX_UPPER_HALFTILE
Querying information about the upper part of a tile with halftile foundation.
Definition: newgrf_commons.h:25
OverrideManagerBase::GetGRFID
uint32_t GetGRFID(uint16_t entity_id) const
Gives the GRFID of the file the entity belongs to.
Definition: newgrf_commons.cpp:139
direction_type.h
GetTerrainType
uint32_t GetTerrainType(TileIndex tile, TileContext context=TCX_NORMAL)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
Definition: newgrf_commons.cpp:331
TLF_DODRAW
@ TLF_DODRAW
Only draw sprite if value of register TileLayoutRegisters::dodraw is non-zero.
Definition: newgrf_commons.h:35
ObjectSpec
Allow incrementing of ObjectClassID variables.
Definition: newgrf_object.h:60
TileLayoutRegisters::dodraw
uint8_t dodraw
Register deciding whether the sprite shall be drawn at all. Non-zero means drawing.
Definition: newgrf_commons.h:92
GRFFileProps::GRFFileProps
GRFFileProps(uint16_t subst_id=0)
Set all default data constructor for the props.
Definition: newgrf_commons.h:326
sprite.h
TLF_CHILD_X_OFFSET
@ TLF_CHILD_X_OFFSET
Add signed offset to child sprite X positions from register TileLayoutRegisters::delta....
Definition: newgrf_commons.h:43
EntityIDMapping::grfid
uint32_t grfid
The GRF ID of the file the entity belongs to.
Definition: newgrf_commons.h:186
EntityIDMapping::entity_id
uint16_t entity_id
The entity ID within the GRF file.
Definition: newgrf_commons.h:187
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:116
NewGRFSpriteLayout::AllocateRegisters
void AllocateRegisters()
Allocate memory for register modifiers.
Definition: newgrf_commons.cpp:615
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
IndustryOverrideManager::AddEntityID
uint16_t AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id) override
Method to find an entity ID and to mark it as reserved for the Industry to be included.
Definition: newgrf_commons.cpp:208
IndustryOverrideManager
Definition: newgrf_commons.h:234
GetNearbyTileInformation
uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
Definition: newgrf_commons.cpp:429
ObjectOverrideManager
Definition: newgrf_commons.h:278
TLF_CUSTOM_PALETTE
@ TLF_CUSTOM_PALETTE
Palette is from Action 1 (moved to SPRITE_MODIFIER_CUSTOM_SPRITE in palette during loading).
Definition: newgrf_commons.h:38
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
NewGRFSpriteLayout::ProcessRegisters
void ProcessRegisters(uint8_t resolved_var10, uint32_t resolved_sprite, bool separate_ground) const
Evaluates the register modifiers and integrates them into the preprocessed sprite layout.
Definition: newgrf_commons.cpp:710
NewGRFSpriteLayout::Clone
void Clone(const DrawTileSprites *source)
Clone a spritelayout.
Definition: newgrf_commons.h:130
GetConstructionStageOffset
uint GetConstructionStageOffset(uint construction_stage, uint num_sprites)
Determines which sprite to use from a spriteset for a specific construction stage.
Definition: newgrf_commons.h:74
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
TLF_BB_Z_OFFSET
@ TLF_BB_Z_OFFSET
Add signed offset to bounding box Z positions from register TileLayoutRegisters::delta....
Definition: newgrf_commons.h:41
AirportSpec
Defines the data structure for an airport.
Definition: newgrf_airport.h:100
TileLayoutRegisters
Additional modifiers for items in sprite layouts.
Definition: newgrf_commons.h:90
alloc_type.hpp
OverrideManagerBase::invalid_id
uint16_t invalid_id
ID used to detected invalid entities.
Definition: newgrf_commons.h:199
TLF_KNOWN_FLAGS
@ TLF_KNOWN_FLAGS
Known flags. Any unknown set flag will disable the GRF.
Definition: newgrf_commons.h:49
DrawTileSprites::ground
PalSpriteID ground
Palette and sprite for the ground.
Definition: sprite.h:59
TileLayoutRegisters::sprite_var10
uint8_t sprite_var10
Value for variable 10 when resolving the sprite.
Definition: newgrf_commons.h:101
AirportTileSpec
Defines the data structure of each individual tile of an airport.
Definition: newgrf_airporttiles.h:68
GRFFileProps::override
uint16_t override
id of the entity been replaced by
Definition: newgrf_commons.h:332
GetErrorMessageFromLocationCallbackResult
CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, const GRFFile *grffile, StringID default_error)
Get the error message from a shape/location/slope check callback result.
Definition: newgrf_commons.cpp:463
TileLayoutRegisters::palette
uint8_t palette
Register specifying a signed offset for the palette.
Definition: newgrf_commons.h:94
ErrorUnknownCallbackResult
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
Definition: newgrf_commons.cpp:499
CommandCost
Common return value for all commands.
Definition: command_type.h:23
GetCompanyInfo
uint32_t GetCompanyInfo(CompanyID owner, const Livery *l)
Returns company information like in vehicle var 43 or station var 43.
Definition: newgrf_commons.cpp:450
TLF_BB_XY_OFFSET
@ TLF_BB_XY_OFFSET
Add signed offset to bounding box X and Y positions from register TileLayoutRegisters::delta....
Definition: newgrf_commons.h:40
OverrideManagerBase::ResetMapping
void ResetMapping()
Resets the mapping, which is used while initializing game.
Definition: newgrf_commons.cpp:72
TLF_CHILD_Y_OFFSET
@ TLF_CHILD_Y_OFFSET
Add signed offset to child sprite Y positions from register TileLayoutRegisters::delta....
Definition: newgrf_commons.h:44
free
void free(const void *ptr)
Version of the standard free that accepts const pointers.
Definition: stdafx.h:382
ZeroedMemoryAllocator
Base class that provides memory initialization on dynamically created objects.
Definition: alloc_type.hpp:85
GRFFileProps
Data related to the handling of grf files.
Definition: newgrf_commons.h:324
TileLayoutRegisters::max_palette_offset
uint16_t max_palette_offset
Maximum offset to add to the palette. (limited by size of the spriteset)
Definition: newgrf_commons.h:96
TileContext
TileContext
Context for tile accesses.
Definition: newgrf_commons.h:23
NewGRFSpriteLayout
NewGRF supplied spritelayout.
Definition: newgrf_commons.h:112
ObjectOverrideManager::SetEntitySpec
void SetEntitySpec(ObjectSpec *spec)
Method to install the new object data in its proper slot The slot assignment is internal of this meth...
Definition: newgrf_commons.cpp:298
NewGRFSpriteLayout::NeedsPreprocessing
bool NeedsPreprocessing() const
Tests whether this spritelayout needs preprocessing by PrepareLayout() and ProcessRegisters(),...
Definition: newgrf_commons.h:149
TLR_MAX_VAR10
static const uint TLR_MAX_VAR10
Maximum value for var 10.
Definition: newgrf_commons.h:105
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58
TCX_NORMAL
@ TCX_NORMAL
Nothing special.
Definition: newgrf_commons.h:24
OverrideManagerBase::GetSubstituteID
uint16_t GetSubstituteID(uint16_t entity_id) const
Gives the substitute of the entity, as specified by the grf file.
Definition: newgrf_commons.cpp:149
OverrideManagerBase::OverrideManagerBase
OverrideManagerBase(uint16_t offset, uint16_t maximum, uint16_t invalid)
Constructor of generic class.
Definition: newgrf_commons.cpp:42
OverrideManagerBase::AddEntityID
virtual uint16_t AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id)
Reserves a place in the mapping array for an entity to be installed.
Definition: newgrf_commons.cpp:109
EntityIDMapping
Maps an entity id stored on the map to a GRF file.
Definition: newgrf_commons.h:185
IndustryOverrideManager::GetID
uint16_t GetID(uint16_t grf_local_id, uint32_t grfid) const override
Return the ID (if ever available) of a previously inserted entity.
Definition: newgrf_commons.cpp:188
TLF_NON_GROUND_FLAGS
@ TLF_NON_GROUND_FLAGS
Flags which do not work for the (first) ground sprite.
Definition: newgrf_commons.h:55
IndustrySpec
Defines the data structure for constructing industry.
Definition: industrytype.h:105
NewGRFSpriteLayout::PrepareLayout
uint32_t PrepareLayout(uint32_t orig_offset, uint32_t newgrf_ground_offset, uint32_t newgrf_offset, uint constr_stage, bool separate_ground) const
Prepares a sprite layout before resolving action-1-2-3 chains.
Definition: newgrf_commons.cpp:639
command_type.h
GRFFilePropsBase::local_id
uint16_t local_id
id defined by the grf file for this entity
Definition: newgrf_commons.h:318
ConvertBooleanCallback
bool ConvertBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
Converts a callback result into a boolean.
Definition: newgrf_commons.cpp:529
GRFFilePropsBase::spritegroup
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
Definition: newgrf_commons.h:320
TLF_VAR10_FLAGS
@ TLF_VAR10_FLAGS
Flags which refer to using multiple action-1-2-3 chains.
Definition: newgrf_commons.h:58
INVALID_AXIS
@ INVALID_AXIS
Flag for an invalid Axis.
Definition: direction_type.h:120
TileLayoutRegisters::parent
uint8_t parent[3]
Registers for signed offsets for the bounding box position of parent sprites.
Definition: newgrf_commons.h:98
HouseOverrideManager
Definition: newgrf_commons.h:224
TCX_ON_BRIDGE
@ TCX_ON_BRIDGE
Querying information about stuff on the bridge (via some bridgehead).
Definition: newgrf_commons.h:26
NewGRFSpriteLayout::consistent_max_offset
uint consistent_max_offset
Number of sprites in all referenced spritesets.
Definition: newgrf_commons.h:119
OverrideManagerBase::ResetOverride
void ResetOverride()
Resets the override, which is used while initializing game.
Definition: newgrf_commons.cpp:78
TileLayoutFlags
TileLayoutFlags
Flags to enable register usage in sprite layouts.
Definition: newgrf_commons.h:32
PalSpriteID
Combination of a palette sprite and a 'real' sprite.
Definition: gfx_type.h:22
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
GetNearbyTile
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets=true, Axis axis=INVALID_AXIS)
Get the tile at the given offset.
Definition: newgrf_commons.cpp:406
IndustryTileOverrideManager
Definition: newgrf_commons.h:247
NewGRFSpriteLayout::Clone
void Clone(const DrawTileSeqStruct *source)
Clone the building sprites of a spritelayout.
Definition: newgrf_commons.cpp:565
DrawTileSprites::seq
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
Definition: sprite.h:60
TileLayoutRegisters::sprite
uint8_t sprite
Register specifying a signed offset for the sprite.
Definition: newgrf_commons.h:93
OverrideManagerBase
Definition: newgrf_commons.h:191
TileLayoutRegisters::flags
TileLayoutFlags flags
Flags defining which members are valid and to be used.
Definition: newgrf_commons.h:91
OverrideManagerBase::max_entities
uint16_t max_entities
what is the amount of entities, old and new summed
Definition: newgrf_commons.h:197
TileLayoutRegisters::child
uint8_t child[2]
Registers for signed offsets for the position of child sprites.
Definition: newgrf_commons.h:99
OverrideManagerBase::Add
void Add(uint16_t local_id, uint32_t grfid, uint entity_type)
Since the entity IDs defined by the GRF file does not necessarily correlate to those used by the game...
Definition: newgrf_commons.cpp:62
HouseSpec
Definition: house.h:98
EntityIDMapping::substitute_id
uint16_t substitute_id
The (original) entity ID to use if this GRF is not available.
Definition: newgrf_commons.h:188
NewGRFSpriteLayout::GetLayout
const DrawTileSeqStruct * GetLayout(PalSpriteID *ground) const
Returns the result spritelayout after preprocessing.
Definition: newgrf_commons.h:162
_object_mngr
ObjectOverrideManager _object_mngr
The override manager for our objects.
TLF_PALETTE_REG_FLAGS
@ TLF_PALETTE_REG_FLAGS
Flags which require resolving the action-1-2-3 chain for the palette, even if it is no action-1 palet...
Definition: newgrf_commons.h:64
TLF_SPRITE
@ TLF_SPRITE
Add signed offset to sprite from register TileLayoutRegisters::sprite.
Definition: newgrf_commons.h:36
TLF_PALETTE
@ TLF_PALETTE
Add signed offset to palette from register TileLayoutRegisters::palette.
Definition: newgrf_commons.h:37
OverrideManagerBase::max_offset
uint16_t max_offset
what is the length of the original entity's array of specs
Definition: newgrf_commons.h:196
GRFFilePropsBase::grffile
const struct GRFFile * grffile
grf file that introduced this entity
Definition: newgrf_commons.h:319
OverrideManagerBase::mappings
std::vector< EntityIDMapping > mappings
mapping of ids from grf files. Public out of convenience
Definition: newgrf_commons.h:203
TileLayoutRegisters::max_sprite_offset
uint16_t max_sprite_offset
Maximum offset to add to the sprite. (limited by size of the spriteset)
Definition: newgrf_commons.h:95
IndustryOverrideManager::SetEntitySpec
void SetEntitySpec(IndustrySpec *inds)
Method to install the new industry data in its proper slot The slot assignment is internal of this me...
Definition: newgrf_commons.cpp:243
IndustryTileSpec
Defines the data structure of each individual tile of an industry.
Definition: industrytype.h:156
TLF_DRAWING_FLAGS
@ TLF_DRAWING_FLAGS
Flags which are still required after loading the GRF.
Definition: newgrf_commons.h:52
TLF_PALETTE_VAR10
@ TLF_PALETTE_VAR10
Resolve palette with a specific value in variable 10.
Definition: newgrf_commons.h:47
TLF_SPRITE_REG_FLAGS
@ TLF_SPRITE_REG_FLAGS
Flags which require resolving the action-1-2-3 chain for the sprite, even if it is no action-1 sprite...
Definition: newgrf_commons.h:61
TLF_SPRITE_VAR10
@ TLF_SPRITE_VAR10
Resolve sprite with a specific value in variable 10.
Definition: newgrf_commons.h:46
GRFFilePropsBase
Data related to the handling of grf files.
Definition: newgrf_commons.h:310
Livery
Information about a particular livery.
Definition: livery.h:78
NewGRFSpriteLayout::result_seq
static std::vector< DrawTileSeqStruct > result_seq
Temporary storage when preprocessing spritelayouts.
Definition: newgrf_commons.h:170
Convert8bitBooleanCallback
bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
Converts a callback result into a boolean.
Definition: newgrf_commons.cpp:548
company_type.h
SpriteGroup
Definition: newgrf_spritegroup.h:57
AirportOverrideManager
Definition: newgrf_commons.h:258
NewGRFSpriteLayout::Allocate
void Allocate(uint num_sprites)
Allocate a spritelayout for num_sprites building sprites.
Definition: newgrf_commons.cpp:603
GRFFile
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:107
OverrideManagerBase::GetID
virtual uint16_t GetID(uint16_t grf_local_id, uint32_t grfid) const
Return the ID (if ever available) of a previously inserted entity.
Definition: newgrf_commons.cpp:90
AirportTileOverrideManager
Definition: newgrf_commons.h:267
DrawTileSeqStruct
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Definition: sprite.h:25
TileLayoutRegisters::palette_var10
uint8_t palette_var10
Value for variable 10 when resolving the palette.
Definition: newgrf_commons.h:102
HouseOverrideManager::SetEntitySpec
void SetEntitySpec(const HouseSpec *hs)
Install the specs into the HouseSpecs array It will find itself the proper slot on which it will go.
Definition: newgrf_commons.cpp:159