tron@2186: /* $Id$ */ tron@2186: belugas@6909: /** @file newgrf_callbacks.h belugas@6909: */ belugas@6909: peter1138@2982: #ifndef NEWGRF_CALLBACKS_H peter1138@2982: #define NEWGRF_CALLBACKS_H truelight@0: truelight@0: peter1138@3007: /** peter1138@3007: * List of implemented NewGRF callbacks. peter1138@3007: * Names are formatted as CBID__ peter1138@3007: */ hackykid@1883: enum CallbackID { belugas@6636: /* Powered wagons, if the result is lower as 0x40 then the wagon is powered belugas@6636: * @todo : interpret the rest of the result, aka "visual effects" */ peter1138@3007: CBID_TRAIN_WAGON_POWER = 0x10, hackykid@1908: belugas@6636: /* Vehicle length, returns the amount of 1/8's the vehicle is shorter belugas@6636: * only for train vehicles */ peter1138@3007: CBID_TRAIN_VEHICLE_LENGTH = 0x11, hackykid@1922: maedhros@6553: /* Called (if appropriate bit in callback mask is set) to determine the maedhros@6553: * amount of cargo to load per unit of time when using gradual loading. */ peter1138@5211: CBID_VEHICLE_LOAD_AMOUNT = 0x12, peter1138@5211: peter1138@3754: /* Called (if appropriate bit in callback mask is set) to determine if a peter1138@3754: * newstation should be made available to build */ peter1138@3754: CBID_STATION_AVAILABILITY = 0x13, peter1138@3754: peter1138@3754: /* Called (if appropriate bit in callback mask is set) when drawing a tile peter1138@3754: * to choose a sprite layout to draw, instead of the standard 0-7 range */ peter1138@3754: CBID_STATION_SPRITE_LAYOUT = 0x14, peter1138@3754: belugas@6636: /* Refit capacity, the passed vehicle needs to have its ->cargo_type set to belugas@6636: * the cargo we are refitting to, returns the new cargo capacity */ peter1138@3007: CBID_VEHICLE_REFIT_CAPACITY = 0x15, peter1138@2602: peter1138@3007: CBID_TRAIN_ARTIC_ENGINE = 0x16, peter1138@3650: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to determine whether maedhros@6658: * the house can be built on the specified tile. */ maedhros@6658: CBID_HOUSE_ALLOW_CONSTRUCTION = 0x17, maedhros@6658: peter1138@4694: CBID_VEHICLE_CARGO_SUFFIX = 0x19, peter1138@4694: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to determine maedhros@6658: * the next animation frame. */ maedhros@6658: CBID_HOUSE_ANIMATION_NEXT_FRAME = 0x1A, maedhros@6658: maedhros@6658: /* Called (if appropriate bit in callback mask is set) for periodically maedhros@6658: * starting or stopping the animation. */ maedhros@6658: CBID_HOUSE_ANIMATION_START_STOP = 0x1B, maedhros@6658: maedhros@6658: /* Called (if appropriate bit in callback mask is set) whenever the maedhros@6658: * construction state of a house changes. */ maedhros@6658: CBID_CONSTRUCTION_STATE_CHANGE = 0x1C, maedhros@6658: peter1138@3727: CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D, peter1138@3727: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to determine the maedhros@6658: * colour of a town building. */ maedhros@6658: CBID_BUILDING_COLOUR = 0x1E, maedhros@6658: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to decide how much maedhros@6658: * cargo a town building can accept. */ maedhros@6658: CBID_HOUSE_CARGO_ACCEPTANCE = 0x1F, // not yet implemented maedhros@6658: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to indicate maedhros@6658: * how long the current animation frame should last. */ maedhros@6658: CBID_HOUSE_ANIMATION_SPEED = 0x20, maedhros@6658: maedhros@6658: /* Called (if appropriate bit in callback mask is set) periodically to maedhros@6658: * determine if a house should be destroyed. */ maedhros@6658: CBID_HOUSE_DESTRUCTION = 0x21, maedhros@6658: belugas@6909: /* Called to determine if the given industry type is available */ belugas@6909: CBID_INDUSTRY_AVAILABLE = 0x22, // not yet implemented belugas@6909: peter1138@3650: /* This callback is called from vehicle purchase lists. It returns a value to be peter1138@3650: * used as a custom string ID in the 0xD000 range. */ peter1138@3650: CBID_VEHICLE_ADDITIONAL_TEXT = 0x23, peter1138@3754: peter1138@3754: /* Called when building a station to customize the tile layout */ peter1138@3754: CBID_STATION_TILE_LAYOUT = 0x24, peter1138@4244: belugas@6909: /* Called for periodically starting or stopping the animation. */ belugas@6909: CBID_INDTILE_ANIM_START_STOP = 0x25, // not yet implemented belugas@6909: belugas@6909: /* Called to determine industry tile next animation frame. */ belugas@6909: CBID_INDTILE_ANIM_NEXT_FRAME = 0x26, // not yet implemented belugas@6909: belugas@6909: /* Called to indicate how long the current animation frame should last. */ belugas@6909: CBID_INDTILE_ANIMATION_SPEED = 0x27, // not yet implemented belugas@6909: belugas@6909: /* Called to determine if the given industry can be built on specific area */ belugas@6909: CBID_INDUSTRY_LOCATION = 0x28, // not yet implemented belugas@6909: belugas@6909: /* Called on production changes, so it can be adjusted */ belugas@6909: CBID_INDUSTRY_PRODUCTION_CHANGE = 0x29, // not yet implemented belugas@6909: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to determine which maedhros@6658: * cargoes a town building should accept. */ maedhros@6658: CBID_HOUSE_ACCEPT_CARGO = 0x2A, // not yet implemented maedhros@6658: belugas@6909: /* Called to query the cargo acceptance of the industry tile */ belugas@6909: CBID_INDTILE_ACCEPT_CARGO = 0x2B, // not yet implemented belugas@6909: belugas@6909: /* Called to determine which cargoes an industry should accept. */ belugas@6909: CBID_INDUSTRY_ACCEPT_CARGO = 0x2C, // not yet implemented belugas@6909: peter1138@5968: /* Called to determine if a specific colour map should be used for a vehicle peter1138@5968: * instead of the default livery */ peter1138@5968: CBID_VEHICLE_COLOUR_MAPPING = 0x2D, peter1138@5968: maedhros@6658: /* Called (if appropriate bit in callback mask is set) to determine how much maedhros@6658: * cargo a town building produces. */ maedhros@6658: CBID_HOUSE_PRODUCE_CARGO = 0x2E, // not yet implemented maedhros@6658: belugas@6909: /* Called to determine if the given industry tile can be built on specific tile */ belugas@6909: CBID_INDTILE_SHAPE_CHECK = 0x2F, // not yet implemented belugas@6909: belugas@6909: /* Called to determine the type (if any) of foundation to draw for industry tile */ belugas@6909: CBID_INDUSTRY_DRAW_FOUNDATIONS = 0x30, // not yet implemented belugas@6909: peter1138@4244: /* Called when the player (or AI) tries to start or stop a vehicle. Mainly peter1138@4244: * used for preventing a vehicle from leaving the depot. */ peter1138@4244: CBID_VEHICLE_START_STOP_CHECK = 0x31, peter1138@4656: peter1138@4656: /* Called to play a special sound effect */ peter1138@4656: CBID_VEHICLE_SOUND_EFFECT = 0x33, maedhros@6658: belugas@6909: /* Called monthly on production changes, so it can be adjusted more frequently */ belugas@6909: CBID_INDUSTRY_MONTHLYPROD_CHANGE= 0x35, // not yet implemented belugas@6909: peter1138@6986: /* Called to modify various vehicle properties. Callback parameter 1 peter1138@6986: * specifies the property index, as used in Action 0, to change. */ peter1138@6986: CBID_VEHICLE_MODIFY_PROPERTY = 0x36, peter1138@6986: belugas@6909: /* Called to determine text to display after cargo name */ belugas@6909: CBID_INDUSTRY_CARGO_SUFFIX = 0x37, // not yet implemented belugas@6909: belugas@6909: /* Called to determine more text in the fund industry window */ belugas@6909: CBID_INDUSTRY_FUND_MORE_TEXT = 0x38, // not yet implemented belugas@6909: peter1138@6685: /* Called to calculate the income of delivered cargo */ peter1138@6685: CBID_CARGO_PROFIT_CALC = 0x39, peter1138@6685: belugas@6909: /* Called to determine more text in the industry window */ belugas@6909: CBID_INDUSTRY_WINDOW_MORE_TEXT = 0x3A, // not yet implemented belugas@6909: belugas@6909: /* Called to determine industry special effects */ belugas@6909: CBID_INDUSTRY_SPECIAL_EFFECT = 0x3B, // not yet implemented belugas@6909: belugas@6909: /* Called to determine if industry can alter the ground below industry tile */ belugas@6909: CBID_INDUSTRY_AUTOSLOPE = 0x3C, // not yet implemented belugas@6909: belugas@6909: /* Called to determine if the industry can still accept or refuse more cargo arrival */ belugas@6909: CBID_INDUSTRY_REFUSE_CARGO = 0x3D, // not yet implemented belugas@6909: maedhros@6658: /* Called (if appropriate bit in callback mask set) to determine whether a maedhros@6658: * town building can be destroyed. */ maedhros@6658: CBID_HOUSE_DENY_DESTRUCTION = 0x143, peter1138@6685: peter1138@6685: /* Called to calculate part of a station rating */ peter1138@6685: CBID_CARGO_STATION_RATING_CALC = 0x145, hackykid@1895: }; hackykid@1895: peter1138@3007: /** peter1138@3007: * Callback masks for vehicles, indicates which callbacks are used by a vehicle. peter1138@3007: * Some callbacks are always used and don't have a mask. peter1138@3007: */ peter1138@3007: enum VehicleCallbackMask { peter1138@3007: CBM_WAGON_POWER = 0, ///< Powered wagons (trains only) peter1138@3007: CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains only) peter1138@3007: CBM_LOAD_AMOUNT = 2, ///< Load amount peter1138@3007: CBM_REFIT_CAPACITY = 3, ///< Cargo capacity after refit peter1138@3007: CBM_ARTIC_ENGINE = 4, ///< Add articulated engines (trains only) peter1138@3007: CBM_CARGO_SUFFIX = 5, ///< Show suffix after cargo name peter1138@3007: CBM_COLOUR_REMAP = 6, ///< Change colour mapping of vehicle peter1138@3007: CBM_SOUND_EFFECT = 7, ///< Vehicle uses custom sound effects hackykid@1883: }; hackykid@1883: peter1138@3007: /** peter1138@3505: * Callback masks for stations. peter1138@3505: */ peter1138@3505: enum StationCallbackMask { peter1138@3505: CBM_STATION_AVAIL = 0, ///< Availability of station in construction window peter1138@3505: CBM_CUSTOM_LAYOUT = 1, ///< Use callback to select a tile layout to use peter1138@3505: }; peter1138@3505: peter1138@3505: /** maedhros@6658: * Callback masks for houses. maedhros@6658: */ maedhros@6658: enum HouseCallbackMask { maedhros@6658: CBM_HOUSE_ALLOW_CONSTRUCTION = 0, maedhros@6658: CBM_ANIMATION_NEXT_FRAME = 1, maedhros@6658: CBM_ANIMATION_START_STOP = 2, maedhros@6658: CBM_CONSTRUCTION_STATE_CHANGE = 3, maedhros@6658: CBM_BUILDING_COLOUR = 4, maedhros@6658: CBM_CARGO_ACCEPTANCE = 5, maedhros@6658: CBM_ANIMATION_SPEED = 6, maedhros@6658: CBM_HOUSE_DESTRUCTION = 7, maedhros@6658: CBM_HOUSE_ACCEPT_CARGO = 8, maedhros@6658: CBM_HOUSE_PRODUCE_CARGO = 9, maedhros@6658: CBM_HOUSE_DENY_DESTRUCTION = 10, maedhros@6658: }; maedhros@6658: maedhros@6658: /** peter1138@6685: * Callback masks for cargos. peter1138@6685: */ peter1138@6685: enum CargoCallbackMask { peter1138@6685: CBM_CARGO_PROFIT_CALC = 0, peter1138@6685: CBM_CARGO_STATION_RATING_CALC = 1, peter1138@6685: }; peter1138@6685: peter1138@6685: /** belugas@6909: * Callback masks for Industries belugas@6909: */ belugas@6909: enum IndustryCallbackMask { belugas@6909: CBM_IND_AVAILABLE = 0, ///< industry availability callback belugas@6909: CBM_IND_PRODUCTION_CARGO_ARRIVAL = 1, ///< call production callback when cargo arrives at the industry belugas@6909: CBM_IND_PRODUCTION_256_TICKS = 2, ///< call production callback every 256 ticks belugas@6909: CBM_IND_LOCATION = 3, ///< check industry construction on given area belugas@6909: CBM_IND_PRODUCTION_CHANGE = 4, ///< controls random production change belugas@6909: CBM_IND_MONTHLYPROD_CHANGE = 5, ///< controls monthly random production change belugas@6909: CBM_IND_CARGO_SUFFIX = 6, ///< cargo sub-type display belugas@6909: CBM_IND_FUND_MORE_TEXT = 7, ///< additional text in fund window belugas@6909: CBM_IND_WINDOW_MORE_TEXT = 8, ///< additional text in industry window belugas@6909: CBM_IND_SPECIAL_EFFECT = 9, ///< control special effects belugas@6909: CBM_IND_REFUSE_CARGO = 10, ///< option out of accepting cargo belugas@6909: }; belugas@6909: belugas@6909: /** belugas@6909: * Callback masks for industry tiles belugas@6909: */ belugas@6909: enum IndustryTileCallbackMask { belugas@6909: CBM_INDT_ANIM_NEXT_FRAME = 0, ///< decides next animation frame belugas@6909: CBM_INDT_ANIM_SPEED = 1, ///< decides animation speed belugas@6909: CBM_INDT_ACCEPTANCE_CARGO = 2, ///< decides amount of cargo acceptance belugas@6909: CBM_INDT_ACCEPT_CARGO = 3, ///< decides accepted types belugas@6909: CBM_INDT_SHAPE_CHECK = 4, ///< decides slope suitability belugas@6909: CBM_INDT_DRAW_FOUNDATIONS = 5, ///< decides if default foundations need to be drawn belugas@6909: CBM_INDT_AUTOSLOPE = 6, ///< decides allowance of autosloping belugas@6909: }; belugas@6909: belugas@6909: /** peter1138@3007: * Result of a failed callback. peter1138@3007: */ hackykid@1883: enum { hackykid@1883: CALLBACK_FAILED = 0xFFFF hackykid@1883: }; hackykid@1883: peter1138@2982: #endif /* NEWGRF_CALLBACKS_H */