tron@2186: /* $Id$ */ tron@2186: peter1138@2982: #ifndef NEWGRF_CALLBACKS_H peter1138@2982: #define NEWGRF_CALLBACKS_H truelight@0: peter1138@2982: /** @file newgrf_callbacks.h peter1138@2962: */ truelight@0: peter1138@3007: /** peter1138@3007: * List of implemented NewGRF callbacks. peter1138@3007: * Names are formatted as CBID__ peter1138@3007: */ hackykid@1883: enum CallbackID { hackykid@1908: // Powered wagons, if the result is lower as 0x40 then the wagon is powered hackykid@1908: // TODO: interpret the rest of the result, aka "visual effects" peter1138@3007: CBID_TRAIN_WAGON_POWER = 0x10, hackykid@1908: hackykid@1922: // Vehicle length, returns the amount of 1/8's the vehicle is shorter hackykid@1922: // only for train vehicles peter1138@3007: CBID_TRAIN_VEHICLE_LENGTH = 0x11, hackykid@1922: peter1138@5211: /* Called to determine the amount of cargo to load per unit of time when peter1138@5211: * 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: hackykid@1883: // Refit capacity, the passed vehicle needs to have its ->cargo_type set to hackykid@1883: // 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: peter1138@4694: CBID_VEHICLE_CARGO_SUFFIX = 0x19, peter1138@4694: peter1138@3727: CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D, peter1138@3727: 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: 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, 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: /** 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 */