OpenTTD Source 20241224-master-gf74b0cf984
newgrf_canal.h File Reference

Handling of NewGRF canals. More...

#include "newgrf.h"
#include "tile_type.h"

Go to the source code of this file.

Data Structures

struct  WaterFeature
 Information about a water feature. More...
 

Enumerations

enum  CanalFeatureFlag { CFF_HAS_FLAT_SPRITE = 0 }
 Flags controlling the display of canals. More...
 

Functions

SpriteID GetCanalSprite (CanalFeature feature, TileIndex tile)
 Lookup the base sprite to use for a canal.
 
uint GetCanalSpriteOffset (CanalFeature feature, TileIndex tile, uint cur_offset)
 Get the new sprite offset for a water tile.
 

Variables

WaterFeature _water_feature [CF_END]
 Table of canal 'feature' sprite groups.
 

Detailed Description

Handling of NewGRF canals.

Definition in file newgrf_canal.h.

Enumeration Type Documentation

◆ CanalFeatureFlag

Flags controlling the display of canals.

Enumerator
CFF_HAS_FLAT_SPRITE 

Additional flat ground sprite in the beginning.

Definition at line 17 of file newgrf_canal.h.

Function Documentation

◆ GetCanalSprite()

SpriteID GetCanalSprite ( CanalFeature  feature,
TileIndex  tile 
)

Lookup the base sprite to use for a canal.

Parameters
featureWhich canal feature we want.
tileTile index of canal, if appropriate.
Returns
Base sprite returned by GRF, or 0 if none.

Definition at line 140 of file newgrf_canal.cpp.

References SpriteGroup::Resolve().

Referenced by DrawCanalWater(), DrawWaterEdges(), and DrawWaterLock().

◆ GetCanalSpriteOffset()

uint GetCanalSpriteOffset ( CanalFeature  feature,
TileIndex  tile,
uint  cur_offset 
)

Get the new sprite offset for a water tile.

Parameters
tileTile index of the canal/water tile.
featureFor which feature to get the new sprite offset.
cur_offsetCurrent sprite offset.
Returns
New sprite offset.

Definition at line 171 of file newgrf_canal.cpp.

References _water_feature, CALLBACK_FAILED, CBID_CANALS_SPRITE_OFFSET, CBM_CANAL_SPRITE_OFFSET, GetCanalCallback(), and HasBit().

Referenced by DrawWaterSprite(), and DrawWaterTileStruct().

Variable Documentation

◆ _water_feature

WaterFeature _water_feature[CF_END]
extern

Table of canal 'feature' sprite groups.

Definition at line 21 of file newgrf_canal.cpp.

Referenced by DrawCanalWater(), DrawWaterLock(), FinaliseCanals(), GetCanalSpriteOffset(), and ResetNewGRFData().