OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
10 #ifndef NEWGRF_OBJECT_H
11 #define NEWGRF_OBJECT_H
90 bool IsEverAvailable()
const;
91 bool WasEverAvailable()
const;
92 bool IsAvailable()
const;
119 uint32
GetVariable(
byte variable, uint32 parameter,
bool *available)
const override;
139 if (tsr !=
nullptr)
return tsr;
@ OBJECT_CLASS_BEGIN
The lowest valid value.
@ OBJECT_FLAG_BUILT_ON_WATER
Object can be built on water (not required).
void TriggerObjectTileAnimation(Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
Trigger the update of animation on a single tile.
A resolver object to be used with feature 0F spritegroups.
@ OBJECT_FLAG_ANIMATION
Object has animated tiles.
uint32 TileIndex
The index/ID of a Tile.
@ OBJECT_FLAG_ONLY_IN_SCENEDIT
Object can only be constructed in the scenario editor.
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
@ OBJECT_FLAG_2CC_COLOUR
Object wants 2CC colour mapping.
Allow incrementing of ObjectClassID variables.
GRFFilePropsBase< 2 > grf_prop
Properties related the the grf file.
ObjectFlags
Various object behaviours.
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0) override
Get a resolver for the scope.
@ OBJECT_FLAG_NONE
Just nothing.
ObjectScopeResolver(ResolverObject &ro, Object *obj, const ObjectSpec *spec, TileIndex tile, uint8 view=0)
Constructor of an object scope resolver.
uint8 build_cost_multiplier
Build cost multiplier per tile.
Tile information, used while rendering the tile.
ObjectResolverObject(const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view=0, CallbackID callback=CBID_NO_CALLBACK, uint32 param1=0, uint32 param2=0)
Constructor of the object resolver.
@ OBJECT_FLAG_CLEAR_INCOME
When object is cleared a positive income is generated instead of a cost.
@ INVALID_OBJECT_CLASS
Class for the less fortunate.
ObjectAnimationTrigger
Animation triggers for objects.
uint32 GetDebugID() const override
Get an identifier for the item being resolved.
struct Object * obj
The object the callback is ran for.
Interface for SpriteGroup-s to access the gamestate.
Information about animation.
Date end_of_life_date
When can't this object be built anymore.
CallbackID
List of implemented NewGRF callbacks.
@ VSG_SCOPE_PARENT
Related object of the resolved one.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
uint8 size
The size of this objects; low nibble for X, high nibble for Y.
uint16 callback_mask
Bitmask of requested/allowed callbacks.
TownScopeResolver * town_scope
The town scope resolver (created on the first call).
Money GetClearCost() const
Get the cost for clearing a structure of this type.
TileIndex tile
The tile related to the object.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
AnimationInfo animation
Information about the animation.
@ VSG_SCOPE_SELF
Resolved object itself.
Date introduction_date
From when can this object be built.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
@ OBJECT_FLAG_CANNOT_REMOVE
Object can not be removed.
ObjectClassID
Class IDs for objects.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
uint16 ObjectType
Types of objects.
void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
Trigger the update of animation on a whole object.
int32 Date
The type to store our dates in.
An object, such as transmitter, on the map.
Struct containing information relating to NewGRF classes for stations and airports.
uint8 height
The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
Get a resolver for the scope.
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view)
Draw representation of an object (tile) for GUI purposes.
Scope resolver for a town.
bool enabled
Is this spec enabled?
void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec)
Draw an object on the map.
uint8 view
The view of the object.
@ OBJECT_FLAG_NOT_ON_LAND
Object can not be on land, implicitly sets OBJECT_FLAG_BUILT_ON_WATER.
StringID name
The name for this object.
void AnimateNewObjectTile(TileIndex tile)
Handle the animation of the object tile.
uint16 GetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view=0)
Perform a callback for an object.
uint8 clear_cost_multiplier
Clear cost multiplier per tile.
@ OBJECT_FLAG_AUTOREMOVE
Object get automatically removed (like "owned land").
@ OBJECT_CLASS_MAX
Maximum number of classes.
uint8 generate_amount
Number of objects which are attempted to be generated per 256^2 map during world generation.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void ResetObjects()
This function initialize the spec arrays of objects.
uint8 views
The number of views.
NewGRFClass< ObjectSpec, ObjectClassID, OBJECT_CLASS_MAX > ObjectClass
Struct containing information relating to object classes.
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override
Used by the resolver to get values for feature 0F deterministic spritegroups.
@ OBJECT_FLAG_ALLOW_UNDER_BRIDGE
Object can built under a bridge.
TownScopeResolver * GetTown()
Get the town resolver scope that belongs to this object resolver.
@ OBJECT_FLAG_ANIM_RANDOM_BITS
Object wants random bits in "next animation frame" callback.
CallbackID callback
Callback being resolved.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
@ OBJECT_FLAG_DRAW_WATER
Object wants to be drawn on water.
const ObjectSpec * spec
Specification of the object type.
static const CargoID CT_PURCHASE_OBJECT
Mapping of purchase for objects.
byte CargoID
Cargo slots to indicate a cargo type within a game.
@ OBJECT_FLAG_HAS_NO_FOUNDATION
Do not display foundations when on a slope.
@ OBJECT_FLAG_SCALE_BY_WATER
Object count is roughly scaled by water amount at edges.
ResolverObject & ro
Surrounding resolver object.
Money GetBuildCost() const
Get the cost for building a structure of this type.
const struct GRFFile * grffile
grf file that introduced this entity
uint8 climate
In which climates is this object available?
uint32 GetRandomBits() const override
Get a few random bits.
ObjectClassID cls_id
The class to which this spec belongs.
ObjectScopeResolver object_scope
The object scope resolver.
@ OBJECT_FLAG_ONLY_IN_GAME
Object can only be built in game.
ObjectFlags flags
Flags/settings related to the object.