OpenTTD Source 20241224-master-gf74b0cf984
|
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_t callback_param1=0, uint32_t callback_param2=0) | |
Resolver constructor. | |
const SpriteGroup * | Resolve () |
Resolve SpriteGroup. | |
uint16_t | 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, uint8_t relative=0) |
Get a resolver for the scope. | |
uint32_t | GetRemainingTriggers () const |
Returns the waiting triggers that did not trigger any rerandomisation. | |
uint32_t | 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. | |
virtual GrfSpecFeature | GetFeature () const |
Get the feature number being resolved for. | |
virtual uint32_t | GetDebugID () const |
Get an identifier for the item being resolved. | |
Data Fields | |
ScopeResolver | default_scope |
Default implementation of the grf scope. | |
CallbackID | callback |
Callback being resolved. | |
uint32_t | callback_param1 |
First parameter (var 10) of the callback. | |
uint32_t | callback_param2 |
Second parameter (var 18) of the callback. | |
uint32_t | last_value |
Result of most recent DeterministicSpriteGroup (including procedure calls) | |
uint32_t | waiting_triggers |
Waiting triggers to be used by any rerandomisation. (scope independent) | |
uint32_t | used_triggers |
Subset of cur_triggers, which actually triggered some rerandomisation. (scope independent) | |
uint32_t | 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 296 of file newgrf_spritegroup.h.
|
inline |
Resolver constructor.
grffile | NewGRF file associated with the object (or nullptr 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 304 of file newgrf_spritegroup.h.
References ResetState().
|
inlinevirtual |
Get an identifier for the item being resolved.
This function is mainly intended for the callback profiling feature, and should return an identifier recognisable by the NewGRF developer.
Reimplemented in AirportResolverObject, AirportTileResolverObject, CanalResolverObject, CargoResolverObject, VehicleResolverObject, GenericResolverObject, HouseResolverObject, IndustriesResolverObject, IndustryTileResolverObject, ObjectResolverObject, RailTypeResolverObject, RoadTypeResolverObject, and StationResolverObject.
Definition at line 394 of file newgrf_spritegroup.h.
Referenced by NewGRFProfiler::BeginResolve().
|
inlinevirtual |
Get the feature number being resolved for.
This function is mainly intended for the callback profiling feature.
Reimplemented in AirportResolverObject, AirportTileResolverObject, CanalResolverObject, CargoResolverObject, VehicleResolverObject, GenericResolverObject, HouseResolverObject, IndustriesResolverObject, IndustryTileResolverObject, ObjectResolverObject, RailTypeResolverObject, RoadTypeResolverObject, and StationResolverObject.
Definition at line 388 of file newgrf_spritegroup.h.
References GSF_INVALID.
Referenced by NewGRFProfiler::BeginResolve().
|
inline |
Returns the waiting triggers that did not trigger any rerandomisation.
Definition at line 353 of file newgrf_spritegroup.h.
|
inline |
Returns the OR-sum of all bits that need reseeding independent of the scope they were accessed with.
Definition at line 363 of file newgrf_spritegroup.h.
|
virtual |
Get a resolver for the scope.
Reimplemented in AirportResolverObject, AirportTileResolverObject, CanalResolverObject, VehicleResolverObject, GenericResolverObject, HouseResolverObject, IndustriesResolverObject, IndustryTileResolverObject, ObjectResolverObject, RailTypeResolverObject, RoadStopResolverObject, RoadTypeResolverObject, StationResolverObject, and TownResolverObject.
Definition at line 135 of file newgrf_spritegroup.cpp.
References default_scope.
Referenced by AirportResolverObject::GetScope(), AirportTileResolverObject::GetScope(), CanalResolverObject::GetScope(), VehicleResolverObject::GetScope(), GenericResolverObject::GetScope(), HouseResolverObject::GetScope(), IndustriesResolverObject::GetScope(), IndustryTileResolverObject::GetScope(), ObjectResolverObject::GetScope(), RailTypeResolverObject::GetScope(), RoadStopResolverObject::GetScope(), RoadTypeResolverObject::GetScope(), StationResolverObject::GetScope(), and TownResolverObject::GetScope().
|
inline |
Resets the dynamic state of the resolver object.
To be called before resolving an Action-1-2-3 chain.
Definition at line 376 of file newgrf_spritegroup.h.
Referenced by ResolverObject().
|
inline |
Resolve SpriteGroup.
Definition at line 331 of file newgrf_spritegroup.h.
References SpriteGroup::Resolve().
Referenced by ResolveCallback().
|
inline |
Resolve callback.
Definition at line 340 of file newgrf_spritegroup.h.
References CALLBACK_FAILED, and Resolve().
|
virtual |
Get the real sprites of the grf.
group | Group to get. |
Reimplemented in VehicleResolverObject, RoadStopResolverObject, and StationResolverObject.
Definition at line 123 of file newgrf_spritegroup.cpp.
References RealSpriteGroup::loaded, and RealSpriteGroup::loading.
CallbackID ResolverObject::callback |
Callback being resolved.
Definition at line 314 of file newgrf_spritegroup.h.
Referenced by NewGRFProfiler::BeginResolve(), and IndustriesScopeResolver::GetVariable().
uint32_t ResolverObject::callback_param1 |
First parameter (var 10) of the callback.
Definition at line 315 of file newgrf_spritegroup.h.
uint32_t ResolverObject::callback_param2 |
Second parameter (var 18) of the callback.
Definition at line 316 of file newgrf_spritegroup.h.
ScopeResolver ResolverObject::default_scope |
Default implementation of the grf scope.
Definition at line 312 of file newgrf_spritegroup.h.
Referenced by GetScope().
const GRFFile* ResolverObject::grffile |
GRFFile the resolved SpriteGroup belongs to.
Definition at line 324 of file newgrf_spritegroup.h.
Referenced by AirportTileScopeResolver::GetVariable(), VehicleScopeResolver::GetVariable(), GenericScopeResolver::GetVariable(), HouseScopeResolver::GetVariable(), IndustriesScopeResolver::GetVariable(), IndustryTileScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), RoadStopScopeResolver::GetVariable(), StationScopeResolver::GetVariable(), TownScopeResolver::GetVariable(), AirportScopeResolver::StorePSA(), and TownScopeResolver::StorePSA().
uint32_t ResolverObject::last_value |
Result of most recent DeterministicSpriteGroup (including procedure calls)
Definition at line 318 of file newgrf_spritegroup.h.
uint32_t ResolverObject::reseed[VSG_END] |
Collects bits to rerandomise while triggering triggers.
Definition at line 322 of file newgrf_spritegroup.h.
const SpriteGroup* ResolverObject::root_spritegroup |
Root SpriteGroup to use for resolving.
Definition at line 325 of file newgrf_spritegroup.h.
Referenced by AirportResolverObject::AirportResolverObject(), AirportTileResolverObject::AirportTileResolverObject(), NewGRFProfiler::BeginResolve(), CanalResolverObject::CanalResolverObject(), CargoResolverObject::CargoResolverObject(), HouseResolverObject::HouseResolverObject(), IndustriesResolverObject::IndustriesResolverObject(), IndustryTileResolverObject::IndustryTileResolverObject(), ObjectResolverObject::ObjectResolverObject(), RailTypeResolverObject::RailTypeResolverObject(), RoadTypeResolverObject::RoadTypeResolverObject(), StationResolverObject::StationResolverObject(), and VehicleResolverObject::VehicleResolverObject().
uint32_t ResolverObject::used_triggers |
Subset of cur_triggers, which actually triggered some rerandomisation. (scope independent)
Definition at line 321 of file newgrf_spritegroup.h.
uint32_t ResolverObject::waiting_triggers |
Waiting triggers to be used by any rerandomisation. (scope independent)
Definition at line 320 of file newgrf_spritegroup.h.