src/newgrf_callbacks.h
branchNewGRF_ports
changeset 6719 4cc327ad39d5
parent 6685 410bba0abb67
child 6720 35756db7e577
equal deleted inserted replaced
6718:5a8b295aa345 6719:4cc327ad39d5
     1 /* $Id$ */
     1 /* $Id$ */
       
     2 
       
     3 /** @file newgrf_callbacks.h
       
     4  */
     2 
     5 
     3 #ifndef NEWGRF_CALLBACKS_H
     6 #ifndef NEWGRF_CALLBACKS_H
     4 #define NEWGRF_CALLBACKS_H
     7 #define NEWGRF_CALLBACKS_H
     5 
     8 
     6 /** @file newgrf_callbacks.h
       
     7  */
       
     8 
     9 
     9 /**
    10 /**
    10  * List of implemented NewGRF callbacks.
    11  * List of implemented NewGRF callbacks.
    11  * Names are formatted as CBID_<CLASS>_<CALLBACK>
    12  * Names are formatted as CBID_<CLASS>_<CALLBACK>
    12  */
    13  */
    71 
    72 
    72 	/* Called (if appropriate bit in callback mask is set) periodically to
    73 	/* Called (if appropriate bit in callback mask is set) periodically to
    73 	 * determine if a house should be destroyed. */
    74 	 * determine if a house should be destroyed. */
    74 	CBID_HOUSE_DESTRUCTION          = 0x21,
    75 	CBID_HOUSE_DESTRUCTION          = 0x21,
    75 
    76 
       
    77 	/* Called to determine if the given industry type is available */
       
    78 	CBID_INDUSTRY_AVAILABLE         = 0x22, // not yet implemented
       
    79 
    76 	/* This callback is called from vehicle purchase lists. It returns a value to be
    80 	/* This callback is called from vehicle purchase lists. It returns a value to be
    77 	 * used as a custom string ID in the 0xD000 range. */
    81 	 * used as a custom string ID in the 0xD000 range. */
    78 	CBID_VEHICLE_ADDITIONAL_TEXT    = 0x23,
    82 	CBID_VEHICLE_ADDITIONAL_TEXT    = 0x23,
    79 
    83 
    80 	/* Called when building a station to customize the tile layout */
    84 	/* Called when building a station to customize the tile layout */
    81 	CBID_STATION_TILE_LAYOUT        = 0x24,
    85 	CBID_STATION_TILE_LAYOUT        = 0x24,
    82 
    86 
       
    87 	/* Called for periodically starting or stopping the animation. */
       
    88 	CBID_INDTILE_ANIM_START_STOP    = 0x25, // not yet implemented
       
    89 
       
    90 	/* Called to determine industry tile next animation frame. */
       
    91 	CBID_INDTILE_ANIM_NEXT_FRAME    = 0x26, // not yet implemented
       
    92 
       
    93 	/* Called to indicate how long the current animation frame should last. */
       
    94 	CBID_INDTILE_ANIMATION_SPEED    = 0x27, // not yet implemented
       
    95 
       
    96 	/* Called to determine if the given industry can be built on specific area */
       
    97 	CBID_INDUSTRY_LOCATION          = 0x28, // not yet implemented
       
    98 
       
    99 	/* Called on production changes, so it can be adjusted */
       
   100 	CBID_INDUSTRY_PRODUCTION_CHANGE = 0x29, // not yet implemented
       
   101 
    83 	/* Called (if appropriate bit in callback mask is set) to determine which
   102 	/* Called (if appropriate bit in callback mask is set) to determine which
    84 	 * cargoes a town building should accept. */
   103 	 * cargoes a town building should accept. */
    85 	CBID_HOUSE_ACCEPT_CARGO         = 0x2A, // not yet implemented
   104 	CBID_HOUSE_ACCEPT_CARGO         = 0x2A, // not yet implemented
    86 
   105 
       
   106 	/* Called to query the cargo acceptance of the industry tile */
       
   107 	CBID_INDTILE_ACCEPT_CARGO       = 0x2B, // not yet implemented
       
   108 
       
   109 	/* Called to determine which cargoes an industry should accept. */
       
   110 	CBID_INDUSTRY_ACCEPT_CARGO      = 0x2C, // not yet implemented
       
   111 
    87 	/* Called to determine if a specific colour map should be used for a vehicle
   112 	/* Called to determine if a specific colour map should be used for a vehicle
    88 	 * instead of the default livery */
   113 	 * instead of the default livery */
    89 	CBID_VEHICLE_COLOUR_MAPPING     = 0x2D,
   114 	CBID_VEHICLE_COLOUR_MAPPING     = 0x2D,
    90 
   115 
    91 	/* Called (if appropriate bit in callback mask is set) to determine how much
   116 	/* Called (if appropriate bit in callback mask is set) to determine how much
    92 	 * cargo a town building produces. */
   117 	 * cargo a town building produces. */
    93 	CBID_HOUSE_PRODUCE_CARGO        = 0x2E, // not yet implemented
   118 	CBID_HOUSE_PRODUCE_CARGO        = 0x2E, // not yet implemented
    94 
   119 
       
   120 	/* Called to determine if the given industry tile can be built on specific tile */
       
   121 	CBID_INDTILE_SHAPE_CHECK        = 0x2F, // not yet implemented
       
   122 
       
   123 	/* Called to determine the type (if any) of foundation to draw for industry tile */
       
   124 	CBID_INDUSTRY_DRAW_FOUNDATIONS  = 0x30, // not yet implemented
       
   125 
    95 	/* Called when the player (or AI) tries to start or stop a vehicle. Mainly
   126 	/* Called when the player (or AI) tries to start or stop a vehicle. Mainly
    96 	 * used for preventing a vehicle from leaving the depot. */
   127 	 * used for preventing a vehicle from leaving the depot. */
    97 	CBID_VEHICLE_START_STOP_CHECK   = 0x31,
   128 	CBID_VEHICLE_START_STOP_CHECK   = 0x31,
    98 
   129 
    99 	/* Called to play a special sound effect */
   130 	/* Called to play a special sound effect */
   100 	CBID_VEHICLE_SOUND_EFFECT       = 0x33,
   131 	CBID_VEHICLE_SOUND_EFFECT       = 0x33,
   101 
   132 
       
   133 	/* Called monthly on production changes, so it can be adjusted more frequently */
       
   134 	CBID_INDUSTRY_MONTHLYPROD_CHANGE= 0x35, // not yet implemented
       
   135 
       
   136 	/* Called to modify various vehicle properties. Callback parameter 1
       
   137 	 * specifies the property index, as used in Action 0, to change. */
       
   138 	CBID_VEHICLE_MODIFY_PROPERTY    = 0x36,
       
   139 
       
   140 	/* Called to determine text to display after cargo name */
       
   141 	CBID_INDUSTRY_CARGO_SUFFIX      = 0x37, // not yet implemented
       
   142 
       
   143 	/* Called to determine more text in the fund industry window */
       
   144 	CBID_INDUSTRY_FUND_MORE_TEXT    = 0x38, // not yet implemented
       
   145 
   102 	/* Called to calculate the income of delivered cargo */
   146 	/* Called to calculate the income of delivered cargo */
   103 	CBID_CARGO_PROFIT_CALC          = 0x39,
   147 	CBID_CARGO_PROFIT_CALC          = 0x39,
       
   148 
       
   149 	/* Called to determine more text in the industry window */
       
   150 	CBID_INDUSTRY_WINDOW_MORE_TEXT  = 0x3A, // not yet implemented
       
   151 
       
   152 	/* Called to determine industry special effects */
       
   153 	CBID_INDUSTRY_SPECIAL_EFFECT    = 0x3B, // not yet implemented
       
   154 
       
   155 	/* Called to determine if industry can alter the ground below industry tile */
       
   156 	CBID_INDUSTRY_AUTOSLOPE         = 0x3C, // not yet implemented
       
   157 
       
   158 	/* Called to determine if the industry can still accept or refuse  more cargo arrival */
       
   159 	CBID_INDUSTRY_REFUSE_CARGO      = 0x3D, // not yet implemented
   104 
   160 
   105 	/* Called (if appropriate bit in callback mask set) to determine whether a
   161 	/* Called (if appropriate bit in callback mask set) to determine whether a
   106 	 * town building can be destroyed. */
   162 	 * town building can be destroyed. */
   107 	CBID_HOUSE_DENY_DESTRUCTION     = 0x143,
   163 	CBID_HOUSE_DENY_DESTRUCTION     = 0x143,
   108 
   164 
   157 	CBM_CARGO_PROFIT_CALC         = 0,
   213 	CBM_CARGO_PROFIT_CALC         = 0,
   158 	CBM_CARGO_STATION_RATING_CALC = 1,
   214 	CBM_CARGO_STATION_RATING_CALC = 1,
   159 };
   215 };
   160 
   216 
   161 /**
   217 /**
       
   218  * Callback masks for Industries
       
   219  */
       
   220 enum IndustryCallbackMask {
       
   221 	CBM_IND_AVAILABLE                 = 0,  ///< industry availability callback
       
   222 	CBM_IND_PRODUCTION_CARGO_ARRIVAL  = 1,  ///< call production callback when cargo arrives at the industry
       
   223 	CBM_IND_PRODUCTION_256_TICKS      = 2,  ///< call production callback every 256 ticks
       
   224 	CBM_IND_LOCATION                  = 3,  ///< check industry construction on given area
       
   225 	CBM_IND_PRODUCTION_CHANGE         = 4,  ///< controls random production change
       
   226 	CBM_IND_MONTHLYPROD_CHANGE        = 5,  ///< controls monthly random production change
       
   227 	CBM_IND_CARGO_SUFFIX              = 6,  ///< cargo sub-type display
       
   228 	CBM_IND_FUND_MORE_TEXT            = 7,  ///< additional text in fund window
       
   229 	CBM_IND_WINDOW_MORE_TEXT          = 8,  ///< additional text in industry window
       
   230 	CBM_IND_SPECIAL_EFFECT            = 9,  ///< control special effects
       
   231 	CBM_IND_REFUSE_CARGO              = 10, ///< option out of accepting cargo
       
   232 };
       
   233 
       
   234 /**
       
   235  * Callback masks for industry tiles
       
   236  */
       
   237 enum IndustryTileCallbackMask {
       
   238 	CBM_INDT_ANIM_NEXT_FRAME          = 0,  ///< decides next animation frame
       
   239 	CBM_INDT_ANIM_SPEED               = 1,  ///< decides animation speed
       
   240 	CBM_INDT_ACCEPTANCE_CARGO         = 2,  ///< decides amount of cargo acceptance
       
   241 	CBM_INDT_ACCEPT_CARGO             = 3,  ///< decides accepted types
       
   242 	CBM_INDT_SHAPE_CHECK              = 4,  ///< decides slope suitability
       
   243 	CBM_INDT_DRAW_FOUNDATIONS         = 5,  ///< decides if default foundations need to be drawn
       
   244 	CBM_INDT_AUTOSLOPE                = 6,  ///< decides allowance of autosloping
       
   245 };
       
   246 
       
   247 /**
   162  * Result of a failed callback.
   248  * Result of a failed callback.
   163  */
   249  */
   164 enum {
   250 enum {
   165 	CALLBACK_FAILED = 0xFFFF
   251 	CALLBACK_FAILED = 0xFFFF
   166 };
   252 };