tron@2186: /* $Id$ */ tron@2186: celestar@9908: /** @file newgrf_callbacks.h celestar@9908: */ celestar@9908: 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 { celestar@9895: /* Powered wagons, if the result is lower as 0x40 then the wagon is powered celestar@9895: * @todo : interpret the rest of the result, aka "visual effects" */ peter1138@3007: CBID_TRAIN_WAGON_POWER = 0x10, hackykid@1908: celestar@9895: /* Vehicle length, returns the amount of 1/8's the vehicle is shorter celestar@9895: * only for train vehicles */ peter1138@3007: CBID_TRAIN_VEHICLE_LENGTH = 0x11, hackykid@1922: celestar@9895: /* Called (if appropriate bit in callback mask is set) to determine the celestar@9895: * 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: celestar@9895: /* Refit capacity, the passed vehicle needs to have its ->cargo_type set to celestar@9895: * 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: celestar@9896: /* Called (if appropriate bit in callback mask is set) to determine whether celestar@9896: * the house can be built on the specified tile. */ celestar@9896: CBID_HOUSE_ALLOW_CONSTRUCTION = 0x17, celestar@9896: peter1138@4694: CBID_VEHICLE_CARGO_SUFFIX = 0x19, peter1138@4694: celestar@9896: /* Called (if appropriate bit in callback mask is set) to determine celestar@9896: * the next animation frame. */ celestar@9896: CBID_HOUSE_ANIMATION_NEXT_FRAME = 0x1A, celestar@9896: celestar@9896: /* Called (if appropriate bit in callback mask is set) for periodically celestar@9896: * starting or stopping the animation. */ celestar@9896: CBID_HOUSE_ANIMATION_START_STOP = 0x1B, celestar@9896: celestar@9896: /* Called (if appropriate bit in callback mask is set) whenever the celestar@9896: * construction state of a house changes. */ celestar@9896: CBID_CONSTRUCTION_STATE_CHANGE = 0x1C, celestar@9896: peter1138@3727: CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D, peter1138@3727: celestar@9896: /* Called (if appropriate bit in callback mask is set) to determine the celestar@9896: * colour of a town building. */ celestar@9896: CBID_BUILDING_COLOUR = 0x1E, celestar@9896: celestar@9896: /* Called (if appropriate bit in callback mask is set) to decide how much celestar@9896: * cargo a town building can accept. */ celestar@9896: CBID_HOUSE_CARGO_ACCEPTANCE = 0x1F, // not yet implemented celestar@9896: celestar@9896: /* Called (if appropriate bit in callback mask is set) to indicate celestar@9896: * how long the current animation frame should last. */ celestar@9896: CBID_HOUSE_ANIMATION_SPEED = 0x20, celestar@9896: celestar@9896: /* Called (if appropriate bit in callback mask is set) periodically to celestar@9896: * determine if a house should be destroyed. */ celestar@9896: CBID_HOUSE_DESTRUCTION = 0x21, celestar@9896: celestar@9908: /* Called to determine if the given industry type is available */ celestar@9908: CBID_INDUSTRY_AVAILABLE = 0x22, // not yet implemented celestar@9908: 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: celestar@9908: /* Called for periodically starting or stopping the animation. */ celestar@9908: CBID_INDTILE_ANIM_START_STOP = 0x25, // not yet implemented celestar@9908: celestar@9908: /* Called to determine industry tile next animation frame. */ celestar@9908: CBID_INDTILE_ANIM_NEXT_FRAME = 0x26, // not yet implemented celestar@9908: celestar@9908: /* Called to indicate how long the current animation frame should last. */ celestar@9908: CBID_INDTILE_ANIMATION_SPEED = 0x27, // not yet implemented celestar@9908: celestar@9908: /* Called to determine if the given industry can be built on specific area */ celestar@9908: CBID_INDUSTRY_LOCATION = 0x28, // not yet implemented celestar@9908: celestar@9908: /* Called on production changes, so it can be adjusted */ celestar@9908: CBID_INDUSTRY_PRODUCTION_CHANGE = 0x29, // not yet implemented celestar@9908: celestar@9896: /* Called (if appropriate bit in callback mask is set) to determine which celestar@9896: * cargoes a town building should accept. */ celestar@9896: CBID_HOUSE_ACCEPT_CARGO = 0x2A, // not yet implemented celestar@9896: celestar@9908: /* Called to query the cargo acceptance of the industry tile */ celestar@9908: CBID_INDTILE_ACCEPT_CARGO = 0x2B, // not yet implemented celestar@9908: celestar@9908: /* Called to determine which cargoes an industry should accept. */ celestar@9908: CBID_INDUSTRY_ACCEPT_CARGO = 0x2C, // not yet implemented celestar@9908: 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: celestar@9896: /* Called (if appropriate bit in callback mask is set) to determine how much celestar@9896: * cargo a town building produces. */ celestar@9896: CBID_HOUSE_PRODUCE_CARGO = 0x2E, // not yet implemented celestar@9896: celestar@9908: /* Called to determine if the given industry tile can be built on specific tile */ celestar@9908: CBID_INDTILE_SHAPE_CHECK = 0x2F, // not yet implemented celestar@9908: celestar@9908: /* Called to determine the type (if any) of foundation to draw for industry tile */ celestar@9908: CBID_INDUSTRY_DRAW_FOUNDATIONS = 0x30, // not yet implemented celestar@9908: 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, celestar@9896: celestar@9908: /* Called monthly on production changes, so it can be adjusted more frequently */ celestar@9908: CBID_INDUSTRY_MONTHLYPROD_CHANGE= 0x35, // not yet implemented celestar@9908: celestar@9908: /* Called to determine text to display after cargo name */ celestar@9908: CBID_INDUSTRY_CARGO_SUFFIX = 0x37, // not yet implemented celestar@9908: celestar@9908: /* Called to determine more text in the fund industry window */ celestar@9908: CBID_INDUSTRY_FUND_MORE_TEXT = 0x38, // not yet implemented celestar@9908: celestar@9906: /* Called to calculate the income of delivered cargo */ celestar@9906: CBID_CARGO_PROFIT_CALC = 0x39, celestar@9906: celestar@9908: /* Called to determine more text in the industry window */ celestar@9908: CBID_INDUSTRY_WINDOW_MORE_TEXT = 0x3A, // not yet implemented celestar@9908: celestar@9908: /* Called to determine industry special effects */ celestar@9908: CBID_INDUSTRY_SPECIAL_EFFECT = 0x3B, // not yet implemented celestar@9908: celestar@9908: /* Called to determine if industry can alter the ground below industry tile */ celestar@9908: CBID_INDUSTRY_AUTOSLOPE = 0x3C, // not yet implemented celestar@9908: celestar@9908: /* Called to determine if the industry can still accept or refuse more cargo arrival */ celestar@9908: CBID_INDUSTRY_REFUSE_CARGO = 0x3D, // not yet implemented celestar@9908: celestar@9896: /* Called (if appropriate bit in callback mask set) to determine whether a celestar@9896: * town building can be destroyed. */ celestar@9896: CBID_HOUSE_DENY_DESTRUCTION = 0x143, celestar@9906: celestar@9906: /* Called to calculate part of a station rating */ celestar@9906: 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: /** celestar@9896: * Callback masks for houses. celestar@9896: */ celestar@9896: enum HouseCallbackMask { celestar@9896: CBM_HOUSE_ALLOW_CONSTRUCTION = 0, celestar@9896: CBM_ANIMATION_NEXT_FRAME = 1, celestar@9896: CBM_ANIMATION_START_STOP = 2, celestar@9896: CBM_CONSTRUCTION_STATE_CHANGE = 3, celestar@9896: CBM_BUILDING_COLOUR = 4, celestar@9896: CBM_CARGO_ACCEPTANCE = 5, celestar@9896: CBM_ANIMATION_SPEED = 6, celestar@9896: CBM_HOUSE_DESTRUCTION = 7, celestar@9896: CBM_HOUSE_ACCEPT_CARGO = 8, celestar@9896: CBM_HOUSE_PRODUCE_CARGO = 9, celestar@9896: CBM_HOUSE_DENY_DESTRUCTION = 10, celestar@9896: }; celestar@9896: celestar@9896: /** celestar@9906: * Callback masks for cargos. celestar@9906: */ celestar@9906: enum CargoCallbackMask { celestar@9906: CBM_CARGO_PROFIT_CALC = 0, celestar@9906: CBM_CARGO_STATION_RATING_CALC = 1, celestar@9906: }; celestar@9906: celestar@9906: /** celestar@9908: * Callback masks for Industries celestar@9908: */ celestar@9908: enum IndustryCallbackMask { celestar@9908: CBM_IND_AVAILABLE = 0, ///< industry availability callback celestar@9908: CBM_IND_PRODUCTION_CARGO_ARRIVAL = 1, ///< call production callback when cargo arrives at the industry celestar@9908: CBM_IND_PRODUCTION_256_TICKS = 2, ///< call production callback every 256 ticks celestar@9908: CBM_IND_LOCATION = 3, ///< check industry construction on given area celestar@9908: CBM_IND_PRODUCTION_CHANGE = 4, ///< controls random production change celestar@9908: CBM_IND_MONTHLYPROD_CHANGE = 5, ///< controls monthly random production change celestar@9908: CBM_IND_CARGO_SUFFIX = 6, ///< cargo sub-type display celestar@9908: CBM_IND_FUND_MORE_TEXT = 7, ///< additional text in fund window celestar@9908: CBM_IND_WINDOW_MORE_TEXT = 8, ///< additional text in industry window celestar@9908: CBM_IND_SPECIAL_EFFECT = 9, ///< control special effects celestar@9908: CBM_IND_REFUSE_CARGO = 10, ///< option out of accepting cargo celestar@9908: }; celestar@9908: celestar@9908: /** celestar@9908: * Callback masks for industry tiles celestar@9908: */ celestar@9908: enum IndustryTileCallbackMask { celestar@9908: CBM_INDT_ANIM_NEXT_FRAME = 0, ///< decides next animation frame celestar@9908: CBM_INDT_ANIM_SPEED = 1, ///< decides animation speed celestar@9908: CBM_INDT_ACCEPTANCE_CARGO = 2, ///< decides amount of cargo acceptance celestar@9908: CBM_INDT_ACCEPT_CARGO = 3, ///< decides accepted types celestar@9908: CBM_INDT_SHAPE_CHECK = 4, ///< decides slope suitability celestar@9908: CBM_INDT_DRAW_FOUNDATIONS = 5, ///< decides if default foundations need to be drawn celestar@9908: CBM_INDT_AUTOSLOPE = 6, ///< decides allowance of autosloping celestar@9908: }; celestar@9908: celestar@9908: /** 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 */