OpenTTD
|
Interface for SpriteGroup-s to access the gamestate. More...
#include <newgrf_spritegroup.h>
Public Member Functions | |
ResolverObject (const GRFFile *grffile, CallbackID callback=CBID_NO_CALLBACK, uint32 callback_param1=0, uint32 callback_param2=0) | |
Resolver constructor. | |
const SpriteGroup * | Resolve () |
Resolve SpriteGroup. | |
uint16 | ResolveCallback () |
Resolve callback. | |
virtual const SpriteGroup * | ResolveReal (const RealSpriteGroup *group) const |
Get the real sprites of the grf. | |
virtual ScopeResolver * | GetScope (VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0) |
Get a resolver for the scope. | |
uint32 | GetReseedSum () const |
Returns the OR-sum of all bits that need reseeding independent of the scope they were accessed with. | |
void | ResetState () |
Resets the dynamic state of the resolver object. |
Data Fields | |
ScopeResolver | default_scope |
Default implementation of the grf scope. | |
CallbackID | callback |
Callback being resolved. | |
uint32 | callback_param1 |
First parameter (var 10) of the callback. | |
uint32 | callback_param2 |
Second parameter (var 18) of the callback. | |
byte | trigger |
uint32 | last_value |
Result of most recent DeterministicSpriteGroup (including procedure calls) | |
uint32 | reseed [VSG_END] |
Collects bits to rerandomise while triggering triggers. | |
const GRFFile * | grffile |
GRFFile the resolved SpriteGroup belongs to. | |
const SpriteGroup * | root_spritegroup |
Root SpriteGroup to use for resolving. |
Interface for SpriteGroup-s to access the gamestate.
Using this interface SpriteGroup-chains (action 1-2-3 chains) can be resolved, to get the results of callbacks, rerandomisations or normal sprite lookups.
Definition at line 308 of file newgrf_spritegroup.h.
ResolverObject::ResolverObject | ( | const GRFFile * | grffile, |
CallbackID | callback = CBID_NO_CALLBACK , |
||
uint32 | callback_param1 = 0 , |
||
uint32 | callback_param2 = 0 |
||
) |
Resolver constructor.
grffile | NewGRF file associated with the object (or NULL if none). |
callback | Callback code being resolved (default value is CBID_NO_CALLBACK). |
callback_param1 | First parameter (var 10) of the callback (only used when callback is also set). |
callback_param2 | Second parameter (var 18) of the callback (only used when callback is also set). |
Definition at line 146 of file newgrf_spritegroup.cpp.
References callback, callback_param1, callback_param2, grffile, ResetState(), and root_spritegroup.
|
inline |
Returns the OR-sum of all bits that need reseeding independent of the scope they were accessed with.
Definition at line 354 of file newgrf_spritegroup.h.
References reseed.
|
virtual |
Get a resolver for the scope.
scope | Scope to return. |
relative | Additional parameter for VSG_SCOPE_RELATIVE. |
Reimplemented in ObjectResolverObject, VehicleResolverObject, StationResolverObject, GenericResolverObject, HouseResolverObject, IndustriesResolverObject, AirportResolverObject, CanalResolverObject, AirportTileResolverObject, IndustryTileResolverObject, TownResolverObject, and RailTypeResolverObject.
Definition at line 176 of file newgrf_spritegroup.cpp.
References default_scope.
|
inline |
Resets the dynamic state of the resolver object.
To be called before resolving an Action-1-2-3 chain.
Definition at line 367 of file newgrf_spritegroup.h.
References last_value, and reseed.
Referenced by ResolverObject().
|
inline |
Resolve SpriteGroup.
Definition at line 330 of file newgrf_spritegroup.h.
References root_spritegroup.
Referenced by ResolveCallback().
|
inline |
Resolve callback.
Definition at line 339 of file newgrf_spritegroup.h.
References CALLBACK_FAILED, and Resolve().
|
virtual |
Get the real sprites of the grf.
group | Group to get. |
Reimplemented in StationResolverObject, VehicleResolverObject, GenericResolverObject, AirportResolverObject, CanalResolverObject, RailTypeResolverObject, and CargoResolverObject.
Definition at line 165 of file newgrf_spritegroup.cpp.