| OpenTTD
    | 
Functions related to NewGRF objects. More...
#include "newgrf_callbacks.h"#include "newgrf_spritegroup.h"#include "newgrf_town.h"#include "economy_func.h"#include "date_type.h"#include "object_type.h"#include "newgrf_animation_type.h"#include "newgrf_class.h"#include "newgrf_commons.h"Go to the source code of this file.
| Data Structures | |
| struct | ObjectSpec | 
| Allow incrementing of ObjectClassID variables.  More... | |
| struct | ObjectScopeResolver | 
| Object scope resolver.  More... | |
| struct | ObjectResolverObject | 
| A resolver object to be used with feature 0F spritegroups.  More... | |
| Typedefs | |
| typedef NewGRFClass < ObjectSpec, ObjectClassID, OBJECT_CLASS_MAX > | ObjectClass | 
| Struct containing information relating to object classes. | |
| Enumerations | |
| enum | ObjectFlags { OBJECT_FLAG_NONE = 0, OBJECT_FLAG_ONLY_IN_SCENEDIT = 1 << 0, OBJECT_FLAG_CANNOT_REMOVE = 1 << 1, OBJECT_FLAG_AUTOREMOVE = 1 << 2, OBJECT_FLAG_BUILT_ON_WATER = 1 << 3, OBJECT_FLAG_CLEAR_INCOME = 1 << 4, OBJECT_FLAG_HAS_NO_FOUNDATION = 1 << 5, OBJECT_FLAG_ANIMATION = 1 << 6, OBJECT_FLAG_ONLY_IN_GAME = 1 << 7, OBJECT_FLAG_2CC_COLOUR = 1 << 8, OBJECT_FLAG_NOT_ON_LAND = 1 << 9, OBJECT_FLAG_DRAW_WATER = 1 << 10, OBJECT_FLAG_ALLOW_UNDER_BRIDGE = 1 << 11, OBJECT_FLAG_ANIM_RANDOM_BITS = 1 << 12, OBJECT_FLAG_SCALE_BY_WATER = 1 << 13 } | 
| Various object behaviours.  More... | |
| enum | ObjectClassID { OBJECT_CLASS_BEGIN = 0, OBJECT_CLASS_MAX = 0xFF, INVALID_OBJECT_CLASS = 0xFF } | 
| Class IDs for objects.  More... | |
| Functions | |
| void | ResetObjects () | 
| This function initialize the spec arrays of objects. | |
| uint16 | GetObjectCallback (CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view=0) | 
| Perform a callback for an object. | |
| void | DrawNewObjectTile (TileInfo *ti, const ObjectSpec *spec) | 
| Draw an object on the map. | |
| void | DrawNewObjectTileInGUI (int x, int y, const ObjectSpec *spec, uint8 view) | 
| Draw representation of an object (tile) for GUI purposes. | |
| void | AnimateNewObjectTile (TileIndex tile) | 
| Handle the animation of the object tile. | |
| void | TriggerObjectTileAnimation (Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec) | 
| Trigger the update of animation on a single tile. | |
| void | TriggerObjectAnimation (Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec) | 
| Trigger the update of animation on a whole object. | |
| Variables | |
| static const CargoID | CT_PURCHASE_OBJECT = 1 | 
| Mapping of purchase for objects. | |
Functions related to NewGRF objects.
Definition in file newgrf_object.h.
Struct containing information relating to object classes.
Definition at line 143 of file newgrf_object.h.
| enum ObjectClassID | 
Class IDs for objects.
| OBJECT_CLASS_BEGIN | The lowest valid value. | 
| OBJECT_CLASS_MAX | Maximum number of classes. | 
| INVALID_OBJECT_CLASS | Class for the less fortunate. | 
Definition at line 48 of file newgrf_object.h.
| enum ObjectFlags | 
Various object behaviours.
| OBJECT_FLAG_NONE | Just nothing. | 
| OBJECT_FLAG_ONLY_IN_SCENEDIT | Object can only be constructed in the scenario editor. | 
| OBJECT_FLAG_CANNOT_REMOVE | Object can not be removed. | 
| OBJECT_FLAG_AUTOREMOVE | Object get automatically removed (like "owned land"). | 
| OBJECT_FLAG_BUILT_ON_WATER | Object can be built on water (not required). | 
| OBJECT_FLAG_CLEAR_INCOME | When object is cleared a positive income is generated instead of a cost. | 
| OBJECT_FLAG_HAS_NO_FOUNDATION | Do not display foundations when on a slope. | 
| OBJECT_FLAG_ANIMATION | Object has animated tiles. | 
| OBJECT_FLAG_ONLY_IN_GAME | Object can only be built in game. | 
| OBJECT_FLAG_2CC_COLOUR | Object wants 2CC colour mapping. | 
| OBJECT_FLAG_NOT_ON_LAND | Object can not be on land, implicitly sets OBJECT_FLAG_BUILT_ON_WATER. | 
| OBJECT_FLAG_DRAW_WATER | Object wants to be drawn on water. | 
| OBJECT_FLAG_ALLOW_UNDER_BRIDGE | Object can built under a bridge. | 
| OBJECT_FLAG_ANIM_RANDOM_BITS | Object wants random bits in "next animation frame" callback. | 
| OBJECT_FLAG_SCALE_BY_WATER | Object count is roughly scaled by water amount at edges. | 
Definition at line 26 of file newgrf_object.h.
| void AnimateNewObjectTile | ( | TileIndex | tile | ) | 
Handle the animation of the object tile.
| tile | The tile to animate. | 
Definition at line 531 of file newgrf_object.cpp.
References AnimationBase< ObjectAnimationBase, ObjectSpec, Object, int, StubGetObjectCallback >::AnimateTile(), ObjectSpec::flags, Object::GetByTile(), ObjectSpec::GetByTile(), OBJECT_FLAG_ANIM_RANDOM_BITS, and OBJECT_FLAG_ANIMATION.
| void DrawNewObjectTile | ( | TileInfo * | ti, | 
| const ObjectSpec * | spec | ||
| ) | 
Draw an object on the map.
| ti | Information about the tile to draw on. | 
| spec | Object spec to draw. | 
Definition at line 452 of file newgrf_object.cpp.
References DrawTileLayout(), Object::GetByTile(), SpriteGroup::Resolve(), and TileInfo::tile.
| void DrawNewObjectTileInGUI | ( | int | x, | 
| int | y, | ||
| const ObjectSpec * | spec, | ||
| uint8 | view | ||
| ) | 
Draw representation of an object (tile) for GUI purposes.
| x | Position x of image. | 
| y | Position y of image. | 
| spec | Object spec to draw. | 
| view | The object's view. | 
Definition at line 470 of file newgrf_object.cpp.
References _local_company, Livery::colour1, Livery::colour2, DrawNewGRFTileSeqInGUI(), DrawSprite(), ObjectSpec::flags, GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), DrawTileSprites::ground, GroundSpritePaletteTransform(), INVALID_TILE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OBJECT_FLAG_2CC_COLOUR, PalSpriteID::pal, PALETTE_RECOLOUR_START, SpriteGroup::Resolve(), PalSpriteID::sprite, and SPRITE_WIDTH.
Referenced by BuildObjectWindow::DrawWidget().
| uint16 GetObjectCallback | ( | CallbackID | callback, | 
| uint32 | param1, | ||
| uint32 | param2, | ||
| const ObjectSpec * | spec, | ||
| Object * | o, | ||
| TileIndex | tile, | ||
| uint8 | view | ||
| ) | 
Perform a callback for an object.
| callback | The callback to perform. | 
| param1 | The first parameter to pass to the NewGRF. | 
| param2 | The second parameter to pass to the NewGRF. | 
| spec | The specification of the object / the entry point. | 
| o | The object to call the callback for. | 
| tile | The tile the callback is called for. | 
| view | The view of the object (only used when o == NULL). | 
Definition at line 414 of file newgrf_object.cpp.
Referenced by BuildObject(), CmdBuildObject(), BuildObjectWindow::DrawWidget(), and StubGetObjectCallback().
| void ResetObjects | ( | ) | 
This function initialize the spec arrays of objects.
Definition at line 96 of file newgrf_object.cpp.
References ObjectSpec::grf_prop, lengthof, GRFFilePropsBase< Tcnt >::local_id, MemCpyT(), and MemSetT().
Referenced by ResetNewGRFData().
| void TriggerObjectAnimation | ( | Object * | o, | 
| ObjectAnimationTrigger | trigger, | ||
| const ObjectSpec * | spec | ||
| ) | 
Trigger the update of animation on a whole object.
| o | The object that got triggered. | 
| trigger | The trigger that is triggered. | 
| spec | The spec associated with the object. | 
Definition at line 559 of file newgrf_object.cpp.
References ObjectSpec::animation, HasBit(), Object::location, TILE_AREA_LOOP, TriggerObjectTileAnimation(), and AnimationInfo::triggers.
Referenced by BuildObject().
| void TriggerObjectTileAnimation | ( | Object * | o, | 
| TileIndex | tile, | ||
| ObjectAnimationTrigger | trigger, | ||
| const ObjectSpec * | spec | ||
| ) | 
Trigger the update of animation on a single tile.
| o | The object that got triggered. | 
| tile | The location of the triggered tile. | 
| trigger | The trigger that is triggered. | 
| spec | The spec associated with the object. | 
Definition at line 546 of file newgrf_object.cpp.
References ObjectSpec::animation, CBID_OBJECT_ANIMATION_START_STOP, AnimationBase< ObjectAnimationBase, ObjectSpec, Object, int, StubGetObjectCallback >::ChangeAnimationFrame(), HasBit(), and AnimationInfo::triggers.
Referenced by TriggerObjectAnimation().
| 
 | static | 
Mapping of purchase for objects.
Definition at line 146 of file newgrf_object.h.
Referenced by ObjectResolverObject::ObjectResolverObject().
 1.8.1.2
 1.8.1.2