src/newgrf_callbacks.h
branchcustombridgeheads
changeset 5643 3778051e8095
parent 5211 651c9272ad22
child 5968 eecf6681445e
equal deleted inserted replaced
5642:bfa6074e2833 5643:3778051e8095
       
     1 /* $Id$ */
       
     2 
       
     3 #ifndef NEWGRF_CALLBACKS_H
       
     4 #define NEWGRF_CALLBACKS_H
       
     5 
       
     6 /** @file newgrf_callbacks.h
       
     7  */
       
     8 
       
     9 /**
       
    10  * List of implemented NewGRF callbacks.
       
    11  * Names are formatted as CBID_<CLASS>_<CALLBACK>
       
    12  */
       
    13 enum CallbackID {
       
    14 	// Powered wagons, if the result is lower as 0x40 then the wagon is powered
       
    15 	// TODO: interpret the rest of the result, aka "visual effects"
       
    16 	CBID_TRAIN_WAGON_POWER          = 0x10,
       
    17 
       
    18 	// Vehicle length, returns the amount of 1/8's the vehicle is shorter
       
    19 	// only for train vehicles
       
    20 	CBID_TRAIN_VEHICLE_LENGTH       = 0x11,
       
    21 
       
    22 	/* Called to determine the amount of cargo to load per unit of time when
       
    23 	 * using gradual loading. */
       
    24 	CBID_VEHICLE_LOAD_AMOUNT        = 0x12,
       
    25 
       
    26 	/* Called (if appropriate bit in callback mask is set) to determine if a
       
    27 	 * newstation should be made available to build */
       
    28 	CBID_STATION_AVAILABILITY       = 0x13,
       
    29 
       
    30 	/* Called (if appropriate bit in callback mask is set) when drawing a tile
       
    31 	 * to choose a sprite layout to draw, instead of the standard 0-7 range */
       
    32 	CBID_STATION_SPRITE_LAYOUT      = 0x14,
       
    33 
       
    34 	// Refit capacity, the passed vehicle needs to have its ->cargo_type set to
       
    35 	// the cargo we are refitting to, returns the new cargo capacity
       
    36 	CBID_VEHICLE_REFIT_CAPACITY     = 0x15,
       
    37 
       
    38 	CBID_TRAIN_ARTIC_ENGINE         = 0x16,
       
    39 
       
    40 	CBID_VEHICLE_CARGO_SUFFIX       = 0x19,
       
    41 
       
    42 	CBID_TRAIN_ALLOW_WAGON_ATTACH   = 0x1D,
       
    43 
       
    44 	/* This callback is called from vehicle purchase lists. It returns a value to be
       
    45 	 * used as a custom string ID in the 0xD000 range. */
       
    46 	CBID_VEHICLE_ADDITIONAL_TEXT    = 0x23,
       
    47 
       
    48 	/* Called when building a station to customize the tile layout */
       
    49 	CBID_STATION_TILE_LAYOUT        = 0x24,
       
    50 
       
    51 	/* Called when the player (or AI) tries to start or stop a vehicle. Mainly
       
    52 	 * used for preventing a vehicle from leaving the depot. */
       
    53 	CBID_VEHICLE_START_STOP_CHECK   = 0x31,
       
    54 
       
    55 	/* Called to play a special sound effect */
       
    56 	CBID_VEHICLE_SOUND_EFFECT       = 0x33,
       
    57 };
       
    58 
       
    59 /**
       
    60  * Callback masks for vehicles, indicates which callbacks are used by a vehicle.
       
    61  * Some callbacks are always used and don't have a mask.
       
    62  */
       
    63 enum VehicleCallbackMask {
       
    64 	CBM_WAGON_POWER    = 0, ///< Powered wagons (trains only)
       
    65 	CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains only)
       
    66 	CBM_LOAD_AMOUNT    = 2, ///< Load amount
       
    67 	CBM_REFIT_CAPACITY = 3, ///< Cargo capacity after refit
       
    68 	CBM_ARTIC_ENGINE   = 4, ///< Add articulated engines (trains only)
       
    69 	CBM_CARGO_SUFFIX   = 5, ///< Show suffix after cargo name
       
    70 	CBM_COLOUR_REMAP   = 6, ///< Change colour mapping of vehicle
       
    71 	CBM_SOUND_EFFECT   = 7, ///< Vehicle uses custom sound effects
       
    72 };
       
    73 
       
    74 /**
       
    75  * Callback masks for stations.
       
    76  */
       
    77 enum StationCallbackMask {
       
    78 	CBM_STATION_AVAIL = 0, ///< Availability of station in construction window
       
    79 	CBM_CUSTOM_LAYOUT = 1, ///< Use callback to select a tile layout to use
       
    80 };
       
    81 
       
    82 /**
       
    83  * Result of a failed callback.
       
    84  */
       
    85 enum {
       
    86 	CALLBACK_FAILED = 0xFFFF
       
    87 };
       
    88 
       
    89 #endif /* NEWGRF_CALLBACKS_H */