OpenTTD
newgrf_callbacks.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef NEWGRF_CALLBACKS_H
11 #define NEWGRF_CALLBACKS_H
12 
20 enum CallbackID {
23 
26 
27  /* There are no callbacks 0x02 - 0x0F. */
28 
30  CBID_VEHICLE_VISUAL_EFFECT = 0x10, // 8 bit callback
31 
34 
36  CBID_VEHICLE_LOAD_AMOUNT = 0x12, // 8 bit callback
37 
39  CBID_STATION_AVAILABILITY = 0x13, // 8 bit callback
40 
43 
48  CBID_VEHICLE_REFIT_CAPACITY = 0x15, // 15 bit callback
49 
51  CBID_VEHICLE_ARTIC_ENGINE = 0x16, // 8 bit callback for grf version < 8
52 
54  CBID_HOUSE_ALLOW_CONSTRUCTION = 0x17, // 8 bit callback
55 
57  CBID_GENERIC_AI_PURCHASE_SELECTION = 0x18, // 8 bit callback, implemented for stations only
58 
61 
63  CBID_HOUSE_ANIMATION_NEXT_FRAME = 0x1A, // 15 bit callback
64 
66  CBID_HOUSE_ANIMATION_START_STOP = 0x1B, // 15 bit callback
67 
69  CBID_HOUSE_CONSTRUCTION_STATE_CHANGE = 0x1C, // 15 bit callback
70 
73 
75  CBID_HOUSE_COLOUR = 0x1E, // 15 bit callback
76 
78  CBID_HOUSE_CARGO_ACCEPTANCE = 0x1F, // 15 bit callback
79 
81  CBID_HOUSE_ANIMATION_SPEED = 0x20, // 8 bit callback
82 
84  CBID_HOUSE_DESTRUCTION = 0x21, // 8 bit callback
85 
87  CBID_INDUSTRY_PROBABILITY = 0x22, // 15 bit callback
88 
94 
96  CBID_STATION_TILE_LAYOUT = 0x24, // 15 bit callback
97 
99  CBID_INDTILE_ANIM_START_STOP = 0x25, // 15 bit callback
100 
102  CBID_INDTILE_ANIM_NEXT_FRAME = 0x26, // 15 bit callback
103 
105  CBID_INDTILE_ANIMATION_SPEED = 0x27, // 8 bit callback
106 
108  CBID_INDUSTRY_LOCATION = 0x28, // 15 bit callback
109 
111  CBID_INDUSTRY_PRODUCTION_CHANGE = 0x29, // 15 bit callback
112 
114  CBID_HOUSE_ACCEPT_CARGO = 0x2A, // 15 bit callback
115 
117  CBID_INDTILE_CARGO_ACCEPTANCE = 0x2B, // 15 bit callback
118 
120  CBID_INDTILE_ACCEPT_CARGO = 0x2C, // 15 bit callback
121 
126  CBID_VEHICLE_COLOUR_MAPPING = 0x2D, // 15 bit callback
127 
129  CBID_HOUSE_PRODUCE_CARGO = 0x2E, // 15 bit callback
130 
132  CBID_INDTILE_SHAPE_CHECK = 0x2F, // 15 bit callback
133 
135  CBID_INDTILE_DRAW_FOUNDATIONS = 0x30, // 15 bit callback
136 
141  CBID_VEHICLE_START_STOP_CHECK = 0x31, // 15 bit callback, but 0xFF test is done with 8 bit
142 
144  CBID_VEHICLE_32DAY_CALLBACK = 0x32, // 2 bit callback
145 
147  CBID_VEHICLE_SOUND_EFFECT = 0x33, // 15 bit callback
148 
150  CBID_VEHICLE_AUTOREPLACE_SELECTION = 0x34, // 15 bit callback, not implemented
151 
153  CBID_INDUSTRY_MONTHLYPROD_CHANGE = 0x35, // 15 bit callback
154 
159  CBID_VEHICLE_MODIFY_PROPERTY = 0x36, // 8/15 bit depends on queried property
160 
162  CBID_INDUSTRY_CARGO_SUFFIX = 0x37, // 15 bit callback, but 0xFF test is done with 8 bit
163 
165  CBID_INDUSTRY_FUND_MORE_TEXT = 0x38, // 15 bit callback
166 
168  CBID_CARGO_PROFIT_CALC = 0x39, // 15 bit callback
169 
171  CBID_INDUSTRY_WINDOW_MORE_TEXT = 0x3A, // 15 bit callback
172 
174  CBID_INDUSTRY_SPECIAL_EFFECT = 0x3B, // 15 bit callback
175 
177  CBID_INDTILE_AUTOSLOPE = 0x3C, // 15 bit callback
178 
180  CBID_INDUSTRY_REFUSE_CARGO = 0x3D, // 15 bit callback
181 
182  /* There are no callbacks 0x3E - 0x13F */
183 
185  CBID_STATION_ANIM_START_STOP = 0x140, // 15 bit callback
186 
188  CBID_STATION_ANIM_NEXT_FRAME = 0x141, // 15 bit callback
189 
191  CBID_STATION_ANIMATION_SPEED = 0x142, // 8 bit callback
192 
194  CBID_HOUSE_DENY_DESTRUCTION = 0x143, // 15 bit callback
195 
197  CBID_SOUNDS_AMBIENT_EFFECT = 0x144, // 15 bit callback
198 
200  CBID_CARGO_STATION_RATING_CALC = 0x145, // 15 bit callback
201 
203  CBID_NEW_SIGNALS_SPRITE_DRAW = 0x146, // 15 bit callback, not implemented
204 
206  CBID_CANALS_SPRITE_OFFSET = 0x147, // 15 bit callback
207 
209  CBID_HOUSE_WATCHED_CARGO_ACCEPTED = 0x148, // 15 bit callback
210 
212  CBID_STATION_LAND_SLOPE_CHECK = 0x149, // 15 bit callback
213 
215  CBID_INDUSTRY_DECIDE_COLOUR = 0x14A, // 4 bit callback
216 
218  CBID_INDUSTRY_INPUT_CARGO_TYPES = 0x14B, // 8 bit callback
219 
221  CBID_INDUSTRY_OUTPUT_CARGO_TYPES = 0x14C, // 8 bit callback
222 
224  CBID_HOUSE_CUSTOM_NAME = 0x14D, // 15 bit callback
225 
227  CBID_HOUSE_DRAW_FOUNDATIONS = 0x14E, // 15 bit callback
228 
230  CBID_HOUSE_AUTOSLOPE = 0x14F, // 15 bit callback
231 
233  CBID_AIRPTILE_DRAW_FOUNDATIONS = 0x150, // 15 bit callback
234 
236  CBID_AIRPTILE_ANIM_START_STOP = 0x152, // 15 bit callback
237 
239  CBID_AIRPTILE_ANIM_NEXT_FRAME = 0x153, // 15 bit callback
240 
242  CBID_AIRPTILE_ANIMATION_SPEED = 0x154, // 8 bit callback
243 
248  CBID_AIRPORT_ADDITIONAL_TEXT = 0x155, // 15 bit callback
249 
251  CBID_AIRPORT_LAYOUT_NAME = 0x156, // 15 bit callback
252 
254  CBID_OBJECT_LAND_SLOPE_CHECK = 0x157, // 15 bit callback
255 
257  CBID_OBJECT_ANIMATION_NEXT_FRAME = 0x158, // 15 bit callback
258 
260  CBID_OBJECT_ANIMATION_START_STOP = 0x159, // 15 bit callback
261 
263  CBID_OBJECT_ANIMATION_SPEED = 0x15A, // 8 bit callback
264 
266  CBID_OBJECT_COLOUR = 0x15B, // 15 bit callback
267 
269  CBID_OBJECT_FUND_MORE_TEXT = 0x15C, // 15 bit callback
270 
272  CBID_OBJECT_AUTOSLOPE = 0x15D, // 15 bit callback
273 
275  CBID_VEHICLE_REFIT_COST = 0x15E, // 15 bit callback
276 
278  CBID_INDUSTRY_PROD_CHANGE_BUILD = 0x15F, // 15 bit callback
279 
281  CBID_VEHICLE_SPAWN_VISUAL_EFFECT = 0x160, // 15 bit callback
282 };
283 
297 };
298 
308 };
309 
327 };
328 
334 };
335 
342 };
343 
363 };
364 
376 };
377 
388 };
389 
399 };
400 
404 static const uint CALLBACK_FAILED = 0xFFFF;
405 static const uint CALLBACK_HOUSEPRODCARGO_END = 0x20FF;
406 
407 #endif /* NEWGRF_CALLBACKS_H */
customize the cargoes the industry produces
This callback is called from airport list.
initialise production level on construction
Called to determine if the given industry can be built on specific area.
Use callback to select a sprite layout to use.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
decides next animation frame
decides accepted types
decides animation speed
Called to determine airport tile next animation frame.
Called to determine more text in the fund object window.
decides animation speed
decides slope suitability
Called to determine if one can alter the ground below a house tile.
Called to determine if the given industry tile can be built on specific tile.
Called to spawn visual effects for vehicles.
Customize the input cargo types of a newly build industry.
Builds articulated engines for trains and RVs.
Called periodically to determine if a house should be destroyed.
Called to indicate how long the current animation frame should last.
Return the vehicles this given vehicle can be "upgraded" to.
Called monthly on production changes, so it can be adjusted more frequently.
Called for periodically starting or stopping the animation.
additional text in fund window
Called when the company (or AI) tries to start or stop a vehicle.
Called to calculate the income of delivered cargo.
custom profit calculation
Set when using the callback resolve system, but not to resolve a callback.
Enable add sprite offset callback.
Determine the next animation frame for a house.
Cargo capacity after refit.
check industry construction on given area
change animation when construction state changes
AI construction/purchase selection.
Determine whether a wagon can be attached to an already existing train.
Called to determine whether a town building can be destroyed.
Called to determine which cargoes a town building should accept.
Visual effects and wagon power.
Called to indicate how long the current animation frame should last.
Determine the cargo "suffixes" for each refit possibility of a cargo.
Callback done for each tile of an object to check the slope.
control special effects
Vehicle uses custom sound effects.
Use a custom next frame callback.
Determine whether a newstation should be made available to build.
decides animation speed
decides amount of cargo acceptance
IndustryCallbackMask
Callback masks for Industries.
Called to determine more text in the fund industry window.
Called to determine the type (if any) of foundation to draw for house tile.
Callback done for each tile of a station to check the slope.
decides allowance of autosloping
decides allowance of autosloping
ObjectCallbackMask
Callback masks for objects.
Called to determine the colour of a town building.
Called to determine the cost factor for refitting a vehicle.
This callback is called from vehicle purchase lists.
Called on the Get Tile Description for an house tile.
Customize the output cargo types of a newly build industry.
Called when a cargo type specified in property 20 is accepted.
decides if default foundations need to be drawn
Called to indicate how long the current animation frame should last.
Customize the animation speed of the station.
Called to play a special sound effect.
Called to determine if the given industry type is available.
controls random production change
decides next animation frame
decides if default foundations need to be drawn
Called to modify various vehicle properties.
Called to determine if industry can alter the ground below industry tile.
custom cargo production
Called to determine the type (if any) of foundation to draw for industry tile.
trigger destruction of building
IndustryTileCallbackMask
Callback masks for industry tiles.
Show suffix after cargo name.
Called to indicate how long the current animation frame should last.
Add an offset to the default sprite numbers to show another sprite.
Vehicle length (trains and road vehicles)
decide the colour of the building
Called for periodically starting or stopping the animation.
decides amount of cargo acceptance
additional text in industry window
CargoCallbackMask
Callback masks for cargoes.
Called to determine text to show as airport layout name.
Change colour mapping of vehicle.
decides allowance of autosloping
StationCallbackMask
Callback masks for stations.
decides next animation frame
customize the cargoes the industry requires
additional text in fund window
AirportTileCallbackMask
Callback masks for airport tiles.
decides animation speed
Called when building a station to customize the tile layout.
Called to determine if a specific colour map should be used for a vehicle instead of the default live...
periodically start/stop the animation
decide the colour of the building
decides accepted types
Called to determine if the industry can still accept or refuse more cargo arrival.
Add articulated engines (trains and road vehicles)
Called whenever the construction state of a house changes.
decides slope suitability
CanalCallbackMask
Callback masks for canals.
Called to determine the colour of an industry.
industry availability/probability callback
controls monthly random production change
Called to determine which cargoes an industry should accept.
Determine whether the house can be built on the specified tile.
Called for every vehicle every 32 days (not all on same date though).
Called to determine the type (if any) of foundation to draw for an airport tile.
Determine the amount of cargo to load per unit of time when using gradual loading.
Refit capacity, the passed vehicle needs to have its ->cargo_type set to the cargo we are refitting t...
Called to determine industry tile next animation frame.
option out of accepting cargo
Called for periodically starting or stopping the animation.
decides next animation frame
VehicleCallbackMask
Callback masks for vehicles, indicates which callbacks are used by a vehicle.
Availability of station in construction window.
Called to determine station tile next animation frame.
Called to query the cargo acceptance of the industry tile.
call production callback when cargo arrives at the industry
Called to indicate how long the current animation frame should last.
cargo sub-type display
decides if default foundations need to be drawn
conditional protection
Allow signal sprites to be replaced dynamically.
Called to determine text to display after cargo name.
CallbackID
List of implemented NewGRF callbacks.
Called for periodically starting or stopping the animation.
decides allowance of autosloping
Select an ambient sound to play for a given type of tile.
Set when calling a randomizing trigger (almost undocumented).
Called to determine the colour of a town building.
Choose a sprite layout to draw, instead of the standard 0-7 range.
Called to determine more text in the industry window.
Check slope of new station tiles.
Determine the next animation frame for a house.
Called to determine if one can alter the ground below an object tile.
Called to determine how much cargo a town building produces.
Vehicle length, returns the amount of 1/8&#39;s the vehicle is shorter for trains and RVs...
decide whether the house can be built on a given tile
Called to decide how much cargo a town building can accept.
Called to determine industry special effects.
static const uint CALLBACK_HOUSEPRODCARGO_END
Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended.
call production callback every 256 ticks
Called when industry is built to set initial production level.
custom station rating for this cargo type
Called on production changes, so it can be adjusted.
Called to calculate part of a station rating.
Visual effects and wagon power (trains, road vehicles and ships)
Called for periodically starting or stopping the animation.
give a custom colour to newly build industries
decides slope suitability
HouseCallbackMask
Callback masks for houses.