23struct CanalScopeResolver :
public ScopeResolver {
32 uint32_t
GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter,
bool &available)
const override;
86 uint32_t connectivity =
102 Debug(grf, 1,
"Unhandled canal variable 0x{:02X}", variable);
115 return this->feature;
143 if (group ==
nullptr || group->num_sprites == 0)
return 0;
145 return group->sprite;
161 return object.ResolveCallback(regs100);
Functions related to debugging.
#define Debug(category, level, format_string,...)
Output a line of debugging information.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
TileIndex TileAddXY(TileIndex tile, int x, int y)
Adds a given offset to a tile.
CanalFeature
List of different canal 'features'.
CallbackID
List of implemented NewGRF callbacks.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
@ CBID_CANALS_SPRITE_OFFSET
Add an offset to the default sprite numbers to show another sprite.
@ SpriteOffset
Enable add sprite offset callback.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
uint GetCanalSpriteOffset(CanalFeature feature, TileIndex tile, uint cur_offset)
Get the new sprite offset for a water tile.
std::array< WaterFeature, CF_END > _water_feature
Table of canal 'feature' sprite groups.
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile)
Lookup the base sprite to use for a canal.
static uint16_t GetCanalCallback(CallbackID callback, uint32_t param1, uint32_t param2, CanalFeature feature, TileIndex tile, std::span< int32_t > regs100={})
Run a specific callback for canals.
Handling of NewGRF canals.
uint32_t GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
VarSpriteGroupScope
Shared by deterministic and random groups.
@ VSG_SCOPE_SELF
Resolved object itself.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Resolver object for canals.
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
CanalResolverObject(CanalFeature feature, TileIndex tile, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Canal resolver constructor.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
Scope resolver of a canal tile.
uint32_t GetVariable(uint8_t variable, uint32_t parameter, bool &available) const override
Get a variable value.
uint32_t GetRandomBits() const override
Get a few random bits.
TileIndex tile
Tile containing the canal.
Interface for SpriteGroup-s to access the gamestate.
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
uint32_t callback_param2
Second parameter (var 18) of the callback.
ResolverObject(const GRFFile *grffile, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Resolver constructor.
CallbackID callback
Callback being resolved.
uint32_t callback_param1
First parameter (var 10) of the callback.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0)
Get a resolver for the scope.
A result sprite group returns the first SpriteID and the number of sprites in the set.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
ResolverObject & ro
Surrounding resolver object.
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
static bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Functions related to water management.
bool IsWateredTile(TileIndex tile, Direction from)
return true if a tile is a water tile wrt.
Map accessors for water tiles.
@ Upper
Upper part of a lock.
bool IsLock(Tile t)
Is there a lock on a given water tile?
uint8_t GetWaterTileRandomBits(Tile t)
Get the random bits of the water tile.
LockPart GetLockPart(Tile t)
Get the part of a lock.