OpenTTD Source: src/newgrf_callbacks.h File Reference

OpenTTD Source 15.0-RC2

Typedefs | Enumerations | Variables
newgrf_callbacks.h File Reference

Callbacks that NewGRFs could implement. More...

`#include "core/enum_type.hpp"`

Go to the source code of this file.

## Typedefs
using | VehicleCallbackMasks = EnumBitSet< VehicleCallbackMask, uint16_t >
using | StationCallbackMasks = EnumBitSet< StationCallbackMask, uint16_t >
using | RoadStopCallbackMasks = EnumBitSet< RoadStopCallbackMask, uint8_t >
using | HouseCallbackMasks = EnumBitSet< HouseCallbackMask, uint16_t >
using | CanalCallbackMasks = EnumBitSet< CanalCallbackMask, uint8_t >
using | CargoCallbackMasks = EnumBitSet< CargoCallbackMask, uint8_t >
using | IndustryCallbackMasks = EnumBitSet< IndustryCallbackMask, uint16_t >
using | IndustryTileCallbackMasks = EnumBitSet< IndustryTileCallbackMask, uint8_t >
using | ObjectCallbackMasks = EnumBitSet< ObjectCallbackMask, uint8_t >
using | AirportTileCallbackMasks = EnumBitSet< AirportTileCallbackMask, uint8_t >

## Enumerations
enum | CallbackID : uint16_t { CBID_NO_CALLBACK = 0x00 , CBID_RANDOM_TRIGGER = 0x01 , CBID_VEHICLE_VISUAL_EFFECT = 0x10 , CBID_VEHICLE_LENGTH = 0x11 , CBID_VEHICLE_LOAD_AMOUNT = 0x12 , CBID_STATION_AVAILABILITY = 0x13 , CBID_STATION_DRAW_TILE_LAYOUT = 0x14 , CBID_VEHICLE_REFIT_CAPACITY = 0x15 , CBID_VEHICLE_ARTIC_ENGINE = 0x16 , CBID_HOUSE_ALLOW_CONSTRUCTION = 0x17 , CBID_GENERIC_AI_PURCHASE_SELECTION = 0x18 , CBID_VEHICLE_CARGO_SUFFIX = 0x19 , CBID_HOUSE_ANIMATION_NEXT_FRAME = 0x1A , CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP = 0x1B , CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED = 0x1C , CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D , CBID_HOUSE_COLOUR = 0x1E , CBID_HOUSE_CARGO_ACCEPTANCE = 0x1F , CBID_HOUSE_ANIMATION_SPEED = 0x20 , CBID_HOUSE_DESTRUCTION = 0x21 , CBID_INDUSTRY_PROBABILITY = 0x22 , CBID_VEHICLE_ADDITIONAL_TEXT = 0x23 , CBID_STATION_BUILD_TILE_LAYOUT = 0x24 , CBID_INDTILE_ANIMATION_TRIGGER = 0x25 , CBID_INDTILE_ANIMATION_NEXT_FRAME = 0x26 , CBID_INDTILE_ANIMATION_SPEED = 0x27 , CBID_INDUSTRY_LOCATION = 0x28 , CBID_INDUSTRY_PRODUCTION_CHANGE = 0x29 , CBID_HOUSE_ACCEPT_CARGO = 0x2A , CBID_INDTILE_CARGO_ACCEPTANCE = 0x2B , CBID_INDTILE_ACCEPT_CARGO = 0x2C , CBID_VEHICLE_COLOUR_MAPPING = 0x2D , CBID_HOUSE_PRODUCE_CARGO = 0x2E , CBID_INDTILE_SHAPE_CHECK = 0x2F , CBID_INDTILE_DRAW_FOUNDATIONS = 0x30 , CBID_VEHICLE_START_STOP_CHECK = 0x31 , CBID_VEHICLE_32DAY_CALLBACK = 0x32 , CBID_VEHICLE_SOUND_EFFECT = 0x33 , CBID_VEHICLE_AUTOREPLACE_SELECTION = 0x34 , CBID_INDUSTRY_MONTHLYPROD_CHANGE = 0x35 , CBID_VEHICLE_MODIFY_PROPERTY = 0x36 , CBID_INDUSTRY_CARGO_SUFFIX = 0x37 , CBID_INDUSTRY_FUND_MORE_TEXT = 0x38 , CBID_CARGO_PROFIT_CALC = 0x39 , CBID_INDUSTRY_WINDOW_MORE_TEXT = 0x3A , CBID_INDUSTRY_SPECIAL_EFFECT = 0x3B , CBID_INDTILE_AUTOSLOPE = 0x3C , CBID_INDUSTRY_REFUSE_CARGO = 0x3D , CBID_STATION_ANIMATION_TRIGGER = 0x140 , CBID_STATION_ANIMATION_NEXT_FRAME = 0x141 , CBID_STATION_ANIMATION_SPEED = 0x142 , CBID_HOUSE_DENY_DESTRUCTION = 0x143 , CBID_SOUNDS_AMBIENT_EFFECT = 0x144 , CBID_CARGO_STATION_RATING_CALC = 0x145 , CBID_NEW_SIGNALS_SPRITE_DRAW = 0x146 , CBID_CANALS_SPRITE_OFFSET = 0x147 , CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED = 0x148 , CBID_STATION_LAND_SLOPE_CHECK = 0x149 , CBID_INDUSTRY_DECIDE_COLOUR = 0x14A , CBID_INDUSTRY_INPUT_CARGO_TYPES = 0x14B , CBID_INDUSTRY_OUTPUT_CARGO_TYPES = 0x14C , CBID_HOUSE_CUSTOM_NAME = 0x14D , CBID_HOUSE_DRAW_FOUNDATIONS = 0x14E , CBID_HOUSE_AUTOSLOPE = 0x14F , CBID_AIRPTILE_DRAW_FOUNDATIONS = 0x150 , CBID_AIRPTILE_ANIMATION_TRIGGER = 0x152 , CBID_AIRPTILE_ANIMATION_NEXT_FRAME = 0x153 , CBID_AIRPTILE_ANIMATION_SPEED = 0x154 , CBID_AIRPORT_ADDITIONAL_TEXT = 0x155 , CBID_AIRPORT_LAYOUT_NAME = 0x156 , CBID_OBJECT_LAND_SLOPE_CHECK = 0x157 , CBID_OBJECT_ANIMATION_NEXT_FRAME = 0x158 , CBID_OBJECT_ANIMATION_TRIGGER = 0x159 , CBID_OBJECT_ANIMATION_SPEED = 0x15A , CBID_OBJECT_COLOUR = 0x15B , CBID_OBJECT_FUND_MORE_TEXT = 0x15C , CBID_OBJECT_AUTOSLOPE = 0x15D , CBID_VEHICLE_REFIT_COST = 0x15E , CBID_INDUSTRY_PROD_CHANGE_BUILD = 0x15F , CBID_VEHICLE_SPAWN_VISUAL_EFFECT = 0x160 , CBID_VEHICLE_NAME = 0x161 , CBID_VEHICLE_BUILD_PROBABILITY = 0x162 , CBID_VEHICLE_CUSTOM_REFIT = 0x0163 }
| List of implemented NewGRF callbacks. More...
enum class | VehicleCallbackMask : uint8_t { VisualEffect = 0 , Length = 1 , LoadAmount = 2 , RefitCapacity = 3 , ArticEngine = 4 , CargoSuffix = 5 , ColourRemap = 6 , SoundEffect = 7 , Name = 8 , CustomRefit = 9 }
| Callback masks for vehicles, indicates which callbacks are used by a vehicle. More...
enum class | StationCallbackMask : uint8_t { Avail = 0 , DrawTileLayout = 1 , AnimationNextFrame = 2 , AnimationSpeed = 3 , SlopeCheck = 4 }
| Callback masks for stations. More...
enum class | RoadStopCallbackMask : uint8_t { Avail = 0 , AnimationNextFrame = 1 , AnimationSpeed = 2 }
| Callback masks for road stops. More...
enum class | HouseCallbackMask : uint8_t { AllowConstruction = 0 , AnimationNextFrame = 1 , AnimationTriggerTileLoop = 2 , AnimationTriggerConstructionStageChanged = 3 , Colour = 4 , CargoAcceptance = 5 , AnimationSpeed = 6 , Destruction = 7 , AcceptCargo = 8 , ProduceCargo = 9 , DenyDestruction = 10 , DrawFoundations = 11 , Autoslope = 12 }
| Callback masks for houses. More...
enum class | CanalCallbackMask : uint8_t { SpriteOffset = 0 }
| Callback masks for canals. More...
enum class | CargoCallbackMask : uint8_t { ProfitCalc = 0 , StationRatingCalc = 1 }
| Callback masks for cargoes. More...
enum class | IndustryCallbackMask : uint8_t { Probability = 0 , ProductionCargoArrival = 1 , Production256Ticks = 2 , Location = 3 , ProductionChange = 4 , MonthlyProdChange = 5 , CargoSuffix = 6 , FundMoreText = 7 , WindowMoreText = 8 , SpecialEffect = 9 , RefuseCargo = 10 , DecideColour = 11 , InputCargoTypes = 12 , OutputCargoTypes = 13 , ProdChangeBuild = 14 }
| Callback masks for Industries. More...
enum class | IndustryTileCallbackMask : uint8_t { AnimationNextFrame = 0 , AnimationSpeed = 1 , CargoAcceptance = 2 , AcceptCargo = 3 , ShapeCheck = 4 , DrawFoundations = 5 , Autoslope = 6 }
| Callback masks for industry tiles. More...
enum class | ObjectCallbackMask : uint8_t { SlopeCheck = 0 , AnimationNextFrame = 1 , AnimationSpeed = 2 , Colour = 3 , FundMoreText = 4 , Autoslope = 5 }
| Callback masks for objects. More...
enum class | AirportTileCallbackMask : uint8_t { AnimationNextFrame = 0 , AnimationSpeed = 1 , ShapeCheck = 4 , DrawFoundations = 5 , Autoslope = 6 }
| Callback masks for airport tiles. More...

## Variables
static const uint | CALLBACK_FAILED = 0xFFFF
| Different values for Callback result evaluations.
static const uint | CALLBACK_HOUSEPRODCARGO_END = 0x20FF
| Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended.

## Detailed Description

Callbacks that NewGRFs could implement.

Definition in file newgrf_callbacks.h.

## Typedef Documentation

## ◆ AirportTileCallbackMasks

using AirportTileCallbackMasks = EnumBitSet<AirportTileCallbackMask, uint8_t>

Definition at line 434 of file newgrf_callbacks.h.

## ◆ CanalCallbackMasks

using CanalCallbackMasks = EnumBitSet<CanalCallbackMask, uint8_t>

Definition at line 364 of file newgrf_callbacks.h.

## ◆ CargoCallbackMasks

using CargoCallbackMasks = EnumBitSet<CargoCallbackMask, uint8_t>

Definition at line 373 of file newgrf_callbacks.h.

## ◆ HouseCallbackMasks

using HouseCallbackMasks = EnumBitSet<HouseCallbackMask, uint16_t>

Definition at line 356 of file newgrf_callbacks.h.

## ◆ IndustryCallbackMasks

using IndustryCallbackMasks = EnumBitSet<IndustryCallbackMask, uint16_t>

Definition at line 395 of file newgrf_callbacks.h.

## ◆ IndustryTileCallbackMasks

using IndustryTileCallbackMasks = EnumBitSet<IndustryTileCallbackMask, uint8_t>

Definition at line 409 of file newgrf_callbacks.h.

## ◆ ObjectCallbackMasks

using ObjectCallbackMasks = EnumBitSet<ObjectCallbackMask, uint8_t>

Definition at line 422 of file newgrf_callbacks.h.

## ◆ RoadStopCallbackMasks

using RoadStopCallbackMasks = EnumBitSet<RoadStopCallbackMask, uint8_t>

Definition at line 336 of file newgrf_callbacks.h.

## ◆ StationCallbackMasks

using StationCallbackMasks = EnumBitSet<StationCallbackMask, uint16_t>

Definition at line 326 of file newgrf_callbacks.h.

## ◆ VehicleCallbackMasks

using VehicleCallbackMasks = EnumBitSet<VehicleCallbackMask, uint16_t>

Definition at line 314 of file newgrf_callbacks.h.

## Enumeration Type Documentation

## ◆ AirportTileCallbackMask

enum class AirportTileCallbackMask : uint8_t
| strong

Callback masks for airport tiles.

Enumerator
AnimationNextFrame | decides next animation frame
AnimationSpeed | decides animation speed
ShapeCheck | decides slope suitability
DrawFoundations | decides if default foundations need to be drawn
Autoslope | decides allowance of autosloping

Definition at line 427 of file newgrf_callbacks.h.

## ◆ CallbackID

enum CallbackID : uint16_t

List of implemented NewGRF callbacks.

Most of these callbacks are only triggered when the corresponding bit is set in the callback flags/trigger for a vehicle, house, industry, etc. Names are formatted as CBID_<CLASS>_<CALLBACK>

Enumerator
CBID_NO_CALLBACK | Set when using the callback resolve system, but not to resolve a callback.
CBID_RANDOM_TRIGGER | Set when calling a randomizing trigger (almost undocumented).
CBID_VEHICLE_VISUAL_EFFECT | Visual effects and wagon power.
CBID_VEHICLE_LENGTH | Vehicle length, returns the amount of 1/8's the vehicle is shorter for trains and RVs.
CBID_VEHICLE_LOAD_AMOUNT | Determine the amount of cargo to load per unit of time when using gradual loading.
CBID_STATION_AVAILABILITY | Determine whether a newstation should be made available to build.
CBID_STATION_DRAW_TILE_LAYOUT | Choose a tile layout to draw, instead of the standard range.
CBID_VEHICLE_REFIT_CAPACITY | Refit capacity, the passed vehicle needs to have its ->cargo_type set to the cargo we are refitting to, returns the new cargo capacity.
CBID_VEHICLE_ARTIC_ENGINE | Builds articulated engines for trains and RVs.
CBID_HOUSE_ALLOW_CONSTRUCTION | Determine whether the house can be built on the specified tile.
CBID_GENERIC_AI_PURCHASE_SELECTION | AI construction/purchase selection.
CBID_VEHICLE_CARGO_SUFFIX | Determine the cargo "suffixes" for each refit possibility of a cargo.
CBID_HOUSE_ANIMATION_NEXT_FRAME | Determine the next animation frame for a house.
CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP | Called for periodically starting or stopping the animation.
CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED | Called whenever the construction stage of a house changes.
CBID_TRAIN_ALLOW_WAGON_ATTACH | Determine whether a wagon can be attached to an already existing train.
CBID_HOUSE_COLOUR | Called to determine the colour of a town building.
CBID_HOUSE_CARGO_ACCEPTANCE | Called to decide how much cargo a town building can accept.
CBID_HOUSE_ANIMATION_SPEED | Called to indicate how long the current animation frame should last.
CBID_HOUSE_DESTRUCTION | Called periodically to determine if a house should be destroyed.
CBID_INDUSTRY_PROBABILITY | Called to determine if the given industry type is available. For grf version >= 8 also a probability can be returned.
CBID_VEHICLE_ADDITIONAL_TEXT | This callback is called from vehicle purchase lists. It returns a value to be used as a custom string ID in the 0xD000 range.
CBID_STATION_BUILD_TILE_LAYOUT | Called when building a station to customize the tile layout.
CBID_INDTILE_ANIMATION_TRIGGER | Called for periodically starting or stopping the animation.
CBID_INDTILE_ANIMATION_NEXT_FRAME | Called to determine industry tile next animation frame.
CBID_INDTILE_ANIMATION_SPEED | Called to indicate how long the current animation frame should last.
CBID_INDUSTRY_LOCATION | Called to determine if the given industry can be built on specific area.
CBID_INDUSTRY_PRODUCTION_CHANGE | Called on production changes, so it can be adjusted.
CBID_HOUSE_ACCEPT_CARGO | Called to determine which cargoes a town building should accept.
CBID_INDTILE_CARGO_ACCEPTANCE | Called to query the cargo acceptance of the industry tile.
CBID_INDTILE_ACCEPT_CARGO | Called to determine which cargoes an industry should accept.
CBID_VEHICLE_COLOUR_MAPPING | Called to determine if a specific colour map should be used for a vehicle instead of the default livery.
CBID_HOUSE_PRODUCE_CARGO | Called to determine how much cargo a town building produces.
CBID_INDTILE_SHAPE_CHECK | Called to determine if the given industry tile can be built on specific tile.
CBID_INDTILE_DRAW_FOUNDATIONS | Called to determine the type (if any) of foundation to draw for industry tile.
CBID_VEHICLE_START_STOP_CHECK | Called when the company (or AI) tries to start or stop a vehicle. Mainly used for preventing a vehicle from leaving the depot.
CBID_VEHICLE_32DAY_CALLBACK | Called for every vehicle every 32 days (not all on same date though).
CBID_VEHICLE_SOUND_EFFECT | Called to play a special sound effect.
CBID_VEHICLE_AUTOREPLACE_SELECTION | Return the vehicles this given vehicle can be "upgraded" to.
CBID_INDUSTRY_MONTHLYPROD_CHANGE | Called monthly on production changes, so it can be adjusted more frequently.
CBID_VEHICLE_MODIFY_PROPERTY | Called to modify various vehicle properties. Callback parameter 1 specifies the property index, as used in Action 0, to change.
CBID_INDUSTRY_CARGO_SUFFIX | Called to determine text to display after cargo name.
CBID_INDUSTRY_FUND_MORE_TEXT | Called to determine more text in the fund industry window.
CBID_CARGO_PROFIT_CALC | Called to calculate the income of delivered cargo.
CBID_INDUSTRY_WINDOW_MORE_TEXT | Called to determine more text in the industry window.
CBID_INDUSTRY_SPECIAL_EFFECT | Called to determine industry special effects.
CBID_INDTILE_AUTOSLOPE | Called to determine if industry can alter the ground below industry tile.
CBID_INDUSTRY_REFUSE_CARGO | Called to determine if the industry can still accept or refuse more cargo arrival.
CBID_STATION_ANIMATION_TRIGGER | Called for periodically starting or stopping the animation.
CBID_STATION_ANIMATION_NEXT_FRAME | Called to determine station tile next animation frame.
CBID_STATION_ANIMATION_SPEED | Called to indicate how long the current animation frame should last.
CBID_HOUSE_DENY_DESTRUCTION | Called to determine whether a town building can be destroyed.
CBID_SOUNDS_AMBIENT_EFFECT | Select an ambient sound to play for a given type of tile.
CBID_CARGO_STATION_RATING_CALC | Called to calculate part of a station rating.
CBID_NEW_SIGNALS_SPRITE_DRAW | Allow signal sprites to be replaced dynamically.
CBID_CANALS_SPRITE_OFFSET | Add an offset to the default sprite numbers to show another sprite.
CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED | Called when a cargo type specified in property 20 is accepted.
CBID_STATION_LAND_SLOPE_CHECK | Callback done for each tile of a station to check the slope.
CBID_INDUSTRY_DECIDE_COLOUR | Called to determine the colour of an industry.
CBID_INDUSTRY_INPUT_CARGO_TYPES | Customize the input cargo types of a newly build industry.
CBID_INDUSTRY_OUTPUT_CARGO_TYPES | Customize the output cargo types of a newly build industry.
CBID_HOUSE_CUSTOM_NAME | Called on the Get Tile Description for an house tile.
CBID_HOUSE_DRAW_FOUNDATIONS | Called to determine the type (if any) of foundation to draw for house tile.
CBID_HOUSE_AUTOSLOPE | Called to determine if one can alter the ground below a house tile.
CBID_AIRPTILE_DRAW_FOUNDATIONS | Called to determine the type (if any) of foundation to draw for an airport tile.
CBID_AIRPTILE_ANIMATION_TRIGGER | Called for periodically starting or stopping the animation.
CBID_AIRPTILE_ANIMATION_NEXT_FRAME | Called to determine airport tile next animation frame.
CBID_AIRPTILE_ANIMATION_SPEED | Called to indicate how long the current animation frame should last.
CBID_AIRPORT_ADDITIONAL_TEXT | This callback is called from airport list. It returns a value to be used as a custom string ID in the 0xD000 range.
CBID_AIRPORT_LAYOUT_NAME | Called to determine text to show as airport layout name.
CBID_OBJECT_LAND_SLOPE_CHECK | Callback done for each tile of an object to check the slope.
CBID_OBJECT_ANIMATION_NEXT_FRAME | Determine the next animation frame for a house.
CBID_OBJECT_ANIMATION_TRIGGER | Called for periodically starting or stopping the animation.
CBID_OBJECT_ANIMATION_SPEED | Called to indicate how long the current animation frame should last.
CBID_OBJECT_COLOUR | Called to determine the colour of a town building.
CBID_OBJECT_FUND_MORE_TEXT | Called to determine more text in the fund object window.
CBID_OBJECT_AUTOSLOPE | Called to determine if one can alter the ground below an object tile.
CBID_VEHICLE_REFIT_COST | Called to determine the cost factor for refitting a vehicle.
CBID_INDUSTRY_PROD_CHANGE_BUILD | Called when industry is built to set initial production level.
CBID_VEHICLE_SPAWN_VISUAL_EFFECT | Called to spawn visual effects for vehicles.
CBID_VEHICLE_NAME | Called to determine the engine name to show.
CBID_VEHICLE_BUILD_PROBABILITY | Called to determine probability during build.
CBID_VEHICLE_CUSTOM_REFIT | Called to get custom engine refit mask. Called once for each defined cargo after all NewGRFs are loaded.

Definition at line 22 of file newgrf_callbacks.h.

## ◆ CanalCallbackMask

enum class CanalCallbackMask : uint8_t
| strong

Callback masks for canals.

Enumerator
SpriteOffset | Enable add sprite offset callback.

Definition at line 361 of file newgrf_callbacks.h.

## ◆ CargoCallbackMask

enum class CargoCallbackMask : uint8_t
| strong

Callback masks for cargoes.

Enumerator
ProfitCalc | custom profit calculation
StationRatingCalc | custom station rating for this cargo type

Definition at line 369 of file newgrf_callbacks.h.

## ◆ HouseCallbackMask

enum class HouseCallbackMask : uint8_t
| strong

Callback masks for houses.

Enumerator
AllowConstruction | decide whether the house can be built on a given tile
AnimationNextFrame | decides next animation frame
AnimationTriggerTileLoop | periodically start/stop the animation
AnimationTriggerConstructionStageChanged | change animation when construction stage changes
Colour | decide the colour of the building
CargoAcceptance | decides amount of cargo acceptance
AnimationSpeed | decides animation speed
Destruction | trigger destruction of building
AcceptCargo | decides accepted types
ProduceCargo | custom cargo production
DenyDestruction | conditional protection
DrawFoundations | decides if default foundations need to be drawn
Autoslope | decides allowance of autosloping

Definition at line 341 of file newgrf_callbacks.h.

## ◆ IndustryCallbackMask

enum class IndustryCallbackMask : uint8_t
| strong

Callback masks for Industries.

Enumerator
Probability | industry availability/probability callback
ProductionCargoArrival | call production callback when cargo arrives at the industry
Production256Ticks | call production callback every 256 ticks
Location | check industry construction on given area
ProductionChange | controls random production change
MonthlyProdChange | controls monthly random production change
CargoSuffix | cargo sub-type display
FundMoreText | additional text in fund window
WindowMoreText | additional text in industry window
SpecialEffect | control special effects
RefuseCargo | option out of accepting cargo
DecideColour | give a custom colour to newly build industries
InputCargoTypes | customize the cargoes the industry requires
OutputCargoTypes | customize the cargoes the industry produces
ProdChangeBuild | initialise production level on construction

Definition at line 378 of file newgrf_callbacks.h.

## ◆ IndustryTileCallbackMask

enum class IndustryTileCallbackMask : uint8_t
| strong

Callback masks for industry tiles.

Enumerator
AnimationNextFrame | decides next animation frame
AnimationSpeed | decides animation speed
CargoAcceptance | decides amount of cargo acceptance
AcceptCargo | decides accepted types
ShapeCheck | decides slope suitability
DrawFoundations | decides if default foundations need to be drawn
Autoslope | decides allowance of autosloping

Definition at line 400 of file newgrf_callbacks.h.

## ◆ ObjectCallbackMask

enum class ObjectCallbackMask : uint8_t
| strong

Callback masks for objects.

Enumerator
SlopeCheck | decides slope suitability
AnimationNextFrame | decides next animation frame
AnimationSpeed | decides animation speed
Colour | decide the colour of the building
FundMoreText | additional text in fund window
Autoslope | decides allowance of autosloping

Definition at line 414 of file newgrf_callbacks.h.

## ◆ RoadStopCallbackMask

enum class RoadStopCallbackMask : uint8_t
| strong

Callback masks for road stops.

Enumerator
Avail | Availability of road stop in construction window.
AnimationNextFrame | Use a custom next frame callback.
AnimationSpeed | Customize the animation speed of the road stop.

Definition at line 331 of file newgrf_callbacks.h.

## ◆ StationCallbackMask

enum class StationCallbackMask : uint8_t
| strong

Callback masks for stations.

Enumerator
Avail | Availability of station in construction window.
DrawTileLayout | Use callback to select a tile layout to use when drawing.
AnimationNextFrame | Use a custom next frame callback.
AnimationSpeed | Customize the animation speed of the station.
SlopeCheck | Check slope of new station tiles.

Definition at line 319 of file newgrf_callbacks.h.

## ◆ VehicleCallbackMask

enum class VehicleCallbackMask : uint8_t
| strong

Callback masks for vehicles, indicates which callbacks are used by a vehicle.

Some callbacks are always used and don't have a mask.

Enumerator
VisualEffect | Visual effects and wagon power (trains, road vehicles and ships)
Length | Vehicle length (trains and road vehicles)
LoadAmount | Load amount.
RefitCapacity | Cargo capacity after refit.
ArticEngine | Add articulated engines (trains and road vehicles)
CargoSuffix | Show suffix after cargo name.
ColourRemap | Change colour mapping of vehicle.
SoundEffect | Vehicle uses custom sound effects.
Name | Engine name.
CustomRefit | Custom refit mask.

Definition at line 302 of file newgrf_callbacks.h.

## Variable Documentation

## ◆ CALLBACK_FAILED

const uint CALLBACK_FAILED = 0xFFFF
| static

Different values for Callback result evaluations.

Result of a failed callback.

Definition at line 439 of file newgrf_callbacks.h.

Referenced by AddAcceptedCargoOfHouse(), AmbientSoundEffectCallback(), AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper >::AnimateTile(), BuildObject(), CalculateRefitMasks(), AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper >::ChangeAnimationFrame(), ChangeIndustryProduction(), CheckIfCallBackAllowsCreation(), CheckTrainAttachment(), CmdBuildObject(), CmdBuildRailStation(), CmdBuildRoadStop(), CmdStartStopVehicle(), Train::ConsistChanged(), Convert8bitBooleanCallback(), ConvertBooleanCallback(), Engine::DetermineCapacity(), DoCreateNewIndustry(), IndustryViewWindow::DrawInfo(), DrawNewHouseTileInGUI(), DrawStationTile(), BuildIndustryWindow::DrawWidget(), BuildObjectWindow::DrawWidget(), GetAiPurchaseCallbackResult(), GetAirportTextCallback(), GetCanalSpriteOffset(), GetCargoSubtypeText(), GetCargoSuffix(), GetFoundation_Town(), GetHouseName(), GetIndustryProbabilityCallback(), GetLoadAmount(), GetNewGRFAdditionalText(), GetNextArticulatedPart(), GetProducedCargoOfHouse(), GetRefitCostFactor(), GetRoadVehLength(), IndustryTemporarilyRefusesCargo(), IsRoadStopAvailable(), IsStationAvailable(), PerformIndustryTileSlopeCheck(), PerformStationTileSlopeCheck(), PlayVehicleSound(), ResolverObject::ResolveCallback(), RunEconomyVehicleDayProc(), SpawnAdvancedVisualEffect(), TestVehicleBuildProbability(), TileLoop_Town(), TryBuildTownHouse(), UpdateStationRating(), and Vehicle::UpdateVisualEffect().

## ◆ CALLBACK_HOUSEPRODCARGO_END

const uint CALLBACK_HOUSEPRODCARGO_END = 0x20FF
| static

Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended.

Definition at line 440 of file newgrf_callbacks.h.

Referenced by GetProducedCargoOfHouse(), and TileLoop_Town().