src/newgrf_callbacks.h
branchnoai
changeset 10294 7798ae816af8
parent 9826 9707ad4c9b60
child 10455 22c441f5adf9
equal deleted inserted replaced
10292:7856e972f8aa 10294:7798ae816af8
    26 
    26 
    27 	/* There are no callbacks 0x02 - 0x0F. */
    27 	/* There are no callbacks 0x02 - 0x0F. */
    28 
    28 
    29 	/** Powered wagons, if the result is lower as 0x40 then the wagon is powered
    29 	/** Powered wagons, if the result is lower as 0x40 then the wagon is powered
    30 	 * @todo : interpret the rest of the result, aka "visual effects". */
    30 	 * @todo : interpret the rest of the result, aka "visual effects". */
    31 	CBID_TRAIN_WAGON_POWER               = 0x10,
    31 	CBID_TRAIN_WAGON_POWER               = 0x10, // 8 bit callback
    32 
    32 
    33 	/** Vehicle length, returns the amount of 1/8's the vehicle is shorter for trains and RVs. */
    33 	/** Vehicle length, returns the amount of 1/8's the vehicle is shorter for trains and RVs. */
    34 	CBID_VEHICLE_LENGTH                  = 0x11,
    34 	CBID_VEHICLE_LENGTH                  = 0x11,
    35 
    35 
    36 	/** Determine the amount of cargo to load per unit of time when using gradual loading. */
    36 	/** Determine the amount of cargo to load per unit of time when using gradual loading. */
    37 	CBID_VEHICLE_LOAD_AMOUNT             = 0x12,
    37 	CBID_VEHICLE_LOAD_AMOUNT             = 0x12, // 8 bit callback
    38 
    38 
    39 	/** Determine whether a newstation should be made available to build. */
    39 	/** Determine whether a newstation should be made available to build. */
    40 	CBID_STATION_AVAILABILITY            = 0x13,
    40 	CBID_STATION_AVAILABILITY            = 0x13, // 8 bit callback
    41 
    41 
    42 	/** Choose a sprite layout to draw, instead of the standard 0-7 range. */
    42 	/** Choose a sprite layout to draw, instead of the standard 0-7 range. */
    43 	CBID_STATION_SPRITE_LAYOUT           = 0x14,
    43 	CBID_STATION_SPRITE_LAYOUT           = 0x14,
    44 
    44 
    45 	/** Refit capacity, the passed vehicle needs to have its ->cargo_type set to
    45 	/** Refit capacity, the passed vehicle needs to have its ->cargo_type set to
    46 	 * the cargo we are refitting to, returns the new cargo capacity. */
    46 	 * the cargo we are refitting to, returns the new cargo capacity. */
    47 	CBID_VEHICLE_REFIT_CAPACITY          = 0x15,
    47 	CBID_VEHICLE_REFIT_CAPACITY          = 0x15, // 15 bit callback
    48 
    48 
    49 	/** Builds articulated engines for trains and RVs. */
    49 	/** Builds articulated engines for trains and RVs. */
    50 	CBID_VEHICLE_ARTIC_ENGINE            = 0x16,
    50 	CBID_VEHICLE_ARTIC_ENGINE            = 0x16, // 8 bit callback
    51 
    51 
    52 	/** Determine whether the house can be built on the specified tile. */
    52 	/** Determine whether the house can be built on the specified tile. */
    53 	CBID_HOUSE_ALLOW_CONSTRUCTION        = 0x17,
    53 	CBID_HOUSE_ALLOW_CONSTRUCTION        = 0x17, // 8 bit callback
    54 
    54 
    55 	/** AI construction/purchase selection */
    55 	/** AI construction/purchase selection */
    56 	CBID_GENERIC_AI_PURCHASE_SELECTION   = 0x18, // not implemented
    56 	CBID_GENERIC_AI_PURCHASE_SELECTION   = 0x18, // 8 bit callback, not implemented
    57 
    57 
    58 	/** Determine the cargo "suffixes" for each refit possibility of a cargo. */
    58 	/** Determine the cargo "suffixes" for each refit possibility of a cargo. */
    59 	CBID_VEHICLE_CARGO_SUFFIX            = 0x19,
    59 	CBID_VEHICLE_CARGO_SUFFIX            = 0x19,
    60 
    60 
    61 	/** Determine the next animation frame for a house. */
    61 	/** Determine the next animation frame for a house. */
    62 	CBID_HOUSE_ANIMATION_NEXT_FRAME      = 0x1A,
    62 	CBID_HOUSE_ANIMATION_NEXT_FRAME      = 0x1A, // 15 bit callback
    63 
    63 
    64 	/** Called for periodically starting or stopping the animation. */
    64 	/** Called for periodically starting or stopping the animation. */
    65 	CBID_HOUSE_ANIMATION_START_STOP      = 0x1B,
    65 	CBID_HOUSE_ANIMATION_START_STOP      = 0x1B, // 15 bit callback
    66 
    66 
    67 	/** Called whenever the construction state of a house changes. */
    67 	/** Called whenever the construction state of a house changes. */
    68 	CBID_HOUSE_CONSTRUCTION_STATE_CHANGE = 0x1C,
    68 	CBID_HOUSE_CONSTRUCTION_STATE_CHANGE = 0x1C, // 15 bit callback
    69 
    69 
    70 	/** Determine whether a wagon can be attached to an already existing train. */
    70 	/** Determine whether a wagon can be attached to an already existing train. */
    71 	CBID_TRAIN_ALLOW_WAGON_ATTACH        = 0x1D,
    71 	CBID_TRAIN_ALLOW_WAGON_ATTACH        = 0x1D,
    72 
    72 
    73 	/** Called to determine the colour of a town building. */
    73 	/** Called to determine the colour of a town building. */
    74 	CBID_HOUSE_COLOUR                    = 0x1E,
    74 	CBID_HOUSE_COLOUR                    = 0x1E, // 15 bit callback
    75 
    75 
    76 	/** Called to decide how much cargo a town building can accept. */
    76 	/** Called to decide how much cargo a town building can accept. */
    77 	CBID_HOUSE_CARGO_ACCEPTANCE          = 0x1F,
    77 	CBID_HOUSE_CARGO_ACCEPTANCE          = 0x1F, // 15 bit callback
    78 
    78 
    79 	/** Called to indicate how long the current animation frame should last. */
    79 	/** Called to indicate how long the current animation frame should last. */
    80 	CBID_HOUSE_ANIMATION_SPEED           = 0x20,
    80 	CBID_HOUSE_ANIMATION_SPEED           = 0x20, // 8 bit callback
    81 
    81 
    82 	/** Called periodically to determine if a house should be destroyed. */
    82 	/** Called periodically to determine if a house should be destroyed. */
    83 	CBID_HOUSE_DESTRUCTION               = 0x21,
    83 	CBID_HOUSE_DESTRUCTION               = 0x21, // 8 bit callback
    84 
    84 
    85 	/** Called to determine if the given industry type is available */
    85 	/** Called to determine if the given industry type is available */
    86 	CBID_INDUSTRY_AVAILABLE              = 0x22,
    86 	CBID_INDUSTRY_AVAILABLE              = 0x22, // 15 bit callback
    87 
    87 
    88 	/** This callback is called from vehicle purchase lists. It returns a value to be
    88 	/** This callback is called from vehicle purchase lists. It returns a value to be
    89 	 * used as a custom string ID in the 0xD000 range. */
    89 	 * used as a custom string ID in the 0xD000 range. */
    90 	CBID_VEHICLE_ADDITIONAL_TEXT         = 0x23,
    90 	CBID_VEHICLE_ADDITIONAL_TEXT         = 0x23,
    91 
    91 
    92 	/** Called when building a station to customize the tile layout */
    92 	/** Called when building a station to customize the tile layout */
    93 	CBID_STATION_TILE_LAYOUT             = 0x24,
    93 	CBID_STATION_TILE_LAYOUT             = 0x24, // 15 bit callback
    94 
    94 
    95 	/** Called for periodically starting or stopping the animation. */
    95 	/** Called for periodically starting or stopping the animation. */
    96 	CBID_INDTILE_ANIM_START_STOP         = 0x25,
    96 	CBID_INDTILE_ANIM_START_STOP         = 0x25, // 15 bit callback
    97 
    97 
    98 	/** Called to determine industry tile next animation frame. */
    98 	/** Called to determine industry tile next animation frame. */
    99 	CBID_INDTILE_ANIM_NEXT_FRAME         = 0x26,
    99 	CBID_INDTILE_ANIM_NEXT_FRAME         = 0x26, // 15 bit callback
   100 
   100 
   101 	/** Called to indicate how long the current animation frame should last. */
   101 	/** Called to indicate how long the current animation frame should last. */
   102 	CBID_INDTILE_ANIMATION_SPEED         = 0x27,
   102 	CBID_INDTILE_ANIMATION_SPEED         = 0x27, // 8 bit callback
   103 
   103 
   104 	/** Called to determine if the given industry can be built on specific area. */
   104 	/** Called to determine if the given industry can be built on specific area. */
   105 	CBID_INDUSTRY_LOCATION               = 0x28,
   105 	CBID_INDUSTRY_LOCATION               = 0x28, // 15 bit callback
   106 
   106 
   107 	/** Called on production changes, so it can be adjusted. */
   107 	/** Called on production changes, so it can be adjusted. */
   108 	CBID_INDUSTRY_PRODUCTION_CHANGE      = 0x29,
   108 	CBID_INDUSTRY_PRODUCTION_CHANGE      = 0x29, // 15 bit callback
   109 
   109 
   110 	/** Called to determine which cargoes a town building should accept. */
   110 	/** Called to determine which cargoes a town building should accept. */
   111 	CBID_HOUSE_ACCEPT_CARGO              = 0x2A,
   111 	CBID_HOUSE_ACCEPT_CARGO              = 0x2A, // 15 bit callback
   112 
   112 
   113 	/** Called to query the cargo acceptance of the industry tile */
   113 	/** Called to query the cargo acceptance of the industry tile */
   114 	CBID_INDTILE_CARGO_ACCEPTANCE        = 0x2B,
   114 	CBID_INDTILE_CARGO_ACCEPTANCE        = 0x2B, // 15 bit callback
   115 
   115 
   116 	/** Called to determine which cargoes an industry should accept. */
   116 	/** Called to determine which cargoes an industry should accept. */
   117 	CBID_INDTILE_ACCEPT_CARGO            = 0x2C,
   117 	CBID_INDTILE_ACCEPT_CARGO            = 0x2C, // 15 bit callback
   118 
   118 
   119 	/** Called to determine if a specific colour map should be used for a vehicle
   119 	/** Called to determine if a specific colour map should be used for a vehicle
   120 	 * instead of the default livery. */
   120 	 * instead of the default livery. */
   121 	CBID_VEHICLE_COLOUR_MAPPING          = 0x2D,
   121 	CBID_VEHICLE_COLOUR_MAPPING          = 0x2D, // 15 bit callback
   122 
   122 
   123 	/** Called to determine how much cargo a town building produces. */
   123 	/** Called to determine how much cargo a town building produces. */
   124 	CBID_HOUSE_PRODUCE_CARGO             = 0x2E,
   124 	CBID_HOUSE_PRODUCE_CARGO             = 0x2E, // 15 bit callback
   125 
   125 
   126 	/** Called to determine if the given industry tile can be built on specific tile. */
   126 	/** Called to determine if the given industry tile can be built on specific tile. */
   127 	CBID_INDTILE_SHAPE_CHECK             = 0x2F,
   127 	CBID_INDTILE_SHAPE_CHECK             = 0x2F, // 15 bit callback
   128 
   128 
   129 	/** Called to determine the type (if any) of foundation to draw for industry tile. */
   129 	/** Called to determine the type (if any) of foundation to draw for industry tile. */
   130 	CBID_INDUSTRY_DRAW_FOUNDATIONS       = 0x30,
   130 	CBID_INDUSTRY_DRAW_FOUNDATIONS       = 0x30, // 15 bit callback
   131 
   131 
   132 	/** Called when the player (or AI) tries to start or stop a vehicle. Mainly
   132 	/** Called when the player (or AI) tries to start or stop a vehicle. Mainly
   133 	 * used for preventing a vehicle from leaving the depot. */
   133 	 * used for preventing a vehicle from leaving the depot. */
   134 	CBID_VEHICLE_START_STOP_CHECK        = 0x31,
   134 	CBID_VEHICLE_START_STOP_CHECK        = 0x31, // 15 bit callback, but 0xFF test is done with 8 bit
   135 
   135 
   136 	/** Called for every vehicle every 32 days (not all on same date though). */
   136 	/** Called for every vehicle every 32 days (not all on same date though). */
   137 	CBID_VEHICLE_32DAY_CALLBACK          = 0x32,
   137 	CBID_VEHICLE_32DAY_CALLBACK          = 0x32, // 2 bit callback
   138 
   138 
   139 	/** Called to play a special sound effect */
   139 	/** Called to play a special sound effect */
   140 	CBID_VEHICLE_SOUND_EFFECT            = 0x33,
   140 	CBID_VEHICLE_SOUND_EFFECT            = 0x33, // 15 bit callback
   141 
   141 
   142 	/** Return the vehicles this given vehicle can be "upgraded" to. */
   142 	/** Return the vehicles this given vehicle can be "upgraded" to. */
   143 	CBID_VEHICLE_AUTOREPLACE_SELECTION   = 0x34,
   143 	CBID_VEHICLE_AUTOREPLACE_SELECTION   = 0x34, // 15 bit callback
   144 
   144 
   145 	/** Called monthly on production changes, so it can be adjusted more frequently */
   145 	/** Called monthly on production changes, so it can be adjusted more frequently */
   146 	CBID_INDUSTRY_MONTHLYPROD_CHANGE     = 0x35,
   146 	CBID_INDUSTRY_MONTHLYPROD_CHANGE     = 0x35, // 15 bit callback
   147 
   147 
   148 	/** Called to modify various vehicle properties. Callback parameter 1
   148 	/** Called to modify various vehicle properties. Callback parameter 1
   149 	 * specifies the property index, as used in Action 0, to change. */
   149 	 * specifies the property index, as used in Action 0, to change. */
   150 	CBID_VEHICLE_MODIFY_PROPERTY         = 0x36,
   150 	CBID_VEHICLE_MODIFY_PROPERTY         = 0x36, // 8/15 bit depends on queried property
   151 
   151 
   152 	/** Called to determine text to display after cargo name */
   152 	/** Called to determine text to display after cargo name */
   153 	CBID_INDUSTRY_CARGO_SUFFIX           = 0x37,
   153 	CBID_INDUSTRY_CARGO_SUFFIX           = 0x37, // 15 bit callback, but 0xFF test is done with 8 bit
   154 
   154 
   155 	/** Called to determine more text in the fund industry window */
   155 	/** Called to determine more text in the fund industry window */
   156 	CBID_INDUSTRY_FUND_MORE_TEXT         = 0x38,
   156 	CBID_INDUSTRY_FUND_MORE_TEXT         = 0x38, // 15 bit callback
   157 
   157 
   158 	/** Called to calculate the income of delivered cargo */
   158 	/** Called to calculate the income of delivered cargo */
   159 	CBID_CARGO_PROFIT_CALC               = 0x39,
   159 	CBID_CARGO_PROFIT_CALC               = 0x39, // 15 bit callback
   160 
   160 
   161 	/** Called to determine more text in the industry window */
   161 	/** Called to determine more text in the industry window */
   162 	CBID_INDUSTRY_WINDOW_MORE_TEXT       = 0x3A,
   162 	CBID_INDUSTRY_WINDOW_MORE_TEXT       = 0x3A, // 15 bit callback
   163 
   163 
   164 	/** Called to determine industry special effects */
   164 	/** Called to determine industry special effects */
   165 	CBID_INDUSTRY_SPECIAL_EFFECT         = 0x3B,
   165 	CBID_INDUSTRY_SPECIAL_EFFECT         = 0x3B, // 15 bit callback
   166 
   166 
   167 	/** Called to determine if industry can alter the ground below industry tile */
   167 	/** Called to determine if industry can alter the ground below industry tile */
   168 	CBID_INDUSTRY_AUTOSLOPE              = 0x3C,
   168 	CBID_INDUSTRY_AUTOSLOPE              = 0x3C, // 15 bit callback
   169 
   169 
   170 	/** Called to determine if the industry can still accept or refuse more cargo arrival */
   170 	/** Called to determine if the industry can still accept or refuse more cargo arrival */
   171 	CBID_INDUSTRY_REFUSE_CARGO           = 0x3D,
   171 	CBID_INDUSTRY_REFUSE_CARGO           = 0x3D, // 15 bit callback
   172 
   172 
   173 	/* There are no callbacks 0x3E - 0x13F */
   173 	/* There are no callbacks 0x3E - 0x13F */
   174 
   174 
   175 	/** Called for periodically starting or stopping the animation. */
   175 	/** Called for periodically starting or stopping the animation. */
   176 	CBID_STATION_ANIM_START_STOP         = 0x140, // not implemented
   176 	CBID_STATION_ANIM_START_STOP         = 0x140, // 15 bit callback
   177 
   177 
   178 	/** Called to determine station tile next animation frame. */
   178 	/** Called to determine station tile next animation frame. */
   179 	CBID_STATION_ANIM_NEXT_FRAME         = 0x141, // not implemented
   179 	CBID_STATION_ANIM_NEXT_FRAME         = 0x141, // 15 bit callback
   180 
   180 
   181 	/** Called to indicate how long the current animation frame should last. */
   181 	/** Called to indicate how long the current animation frame should last. */
   182 	CBID_STATION_ANIMATION_SPEED         = 0x142, // not implemented
   182 	CBID_STATION_ANIMATION_SPEED         = 0x142, // 8 bit callback
   183 
   183 
   184 	/** Called to determine whether a town building can be destroyed. */
   184 	/** Called to determine whether a town building can be destroyed. */
   185 	CBID_HOUSE_DENY_DESTRUCTION          = 0x143,
   185 	CBID_HOUSE_DENY_DESTRUCTION          = 0x143, // 15 bit callback
   186 
   186 
   187 	/** Select an ambient sound to play for a given type of tile. */
   187 	/** Select an ambient sound to play for a given type of tile. */
   188 	CBID_SOUNDS_AMBIENT_EFFECT           = 0x144, // not implemented
   188 	CBID_SOUNDS_AMBIENT_EFFECT           = 0x144, // 15 bit callback, not implemented
   189 
   189 
   190 	/** Called to calculate part of a station rating. */
   190 	/** Called to calculate part of a station rating. */
   191 	CBID_CARGO_STATION_RATING_CALC       = 0x145,
   191 	CBID_CARGO_STATION_RATING_CALC       = 0x145, // 15 bit callback, not implemented
   192 
   192 
   193 	/** Allow signal sprites to be replaced dynamically. */
   193 	/** Allow signal sprites to be replaced dynamically. */
   194 	CBID_NEW_SIGNALS_SPRITE_DRAW         = 0x146, // not implemented
   194 	CBID_NEW_SIGNALS_SPRITE_DRAW         = 0x146, // 15 bit callback, not implemented
   195 
   195 
   196 	/** Add an offset to the default sprite numbers to show another sprite. */
   196 	/** Add an offset to the default sprite numbers to show another sprite. */
   197 	CBID_CANALS_SPRITE_OFFSET            = 0x147, // not implemented
   197 	CBID_CANALS_SPRITE_OFFSET            = 0x147, // 15 bit callback, not implemented
   198 
   198 
   199 	/** Called when a cargo type specified in property 20 is accepted. */
   199 	/** Called when a cargo type specified in property 20 is accepted. */
   200 	CBID_HOUSE_WATCHED_CARGO_ACCEPTED    = 0x148, // not implemented
   200 	CBID_HOUSE_WATCHED_CARGO_ACCEPTED    = 0x148, // 15 bit callback, not implemented
   201 
   201 
   202 	/** Callback done for each tile of a station to check the slope. */
   202 	/** Callback done for each tile of a station to check the slope. */
   203 	CBID_STATION_LAND_SLOPE_CHECK        = 0x149, // not implemented
   203 	CBID_STATION_LAND_SLOPE_CHECK        = 0x149, // 15 bit callback, not implemented
   204 
   204 
   205 	/** Called to determine the color of an industry. */
   205 	/** Called to determine the color of an industry. */
   206 	CBID_INDUSTRY_DECIDE_COLOUR          = 0x14A,
   206 	CBID_INDUSTRY_DECIDE_COLOUR          = 0x14A, // 4 bit callback
   207 
   207 
   208 	/** Customize the input cargo types of a newly build industry. */
   208 	/** Customize the input cargo types of a newly build industry. */
   209 	CBID_INDUSTRY_INPUT_CARGO_TYPES      = 0x14B,
   209 	CBID_INDUSTRY_INPUT_CARGO_TYPES      = 0x14B, // 8 bit callback
   210 
   210 
   211 	/** Customize the output cargo types of a newly build industry. */
   211 	/** Customize the output cargo types of a newly build industry. */
   212 	CBID_INDUSTRY_OUTPUT_CARGO_TYPES     = 0x14C,
   212 	CBID_INDUSTRY_OUTPUT_CARGO_TYPES     = 0x14C, // 8 bit callback
   213 
       
   214 	/* ATTENTION:
       
   215 	 * When adding new callbacks and their result is 15bit, add them to newgrf_spritegroup.cpp:Is8BitCallback().
       
   216 	 * It does not harm to add them there though they are not implemented. But it does harm if they get forgotton.
       
   217 	 */
       
   218 };
   213 };
   219 
   214 
   220 /**
   215 /**
   221  * Callback masks for vehicles, indicates which callbacks are used by a vehicle.
   216  * Callback masks for vehicles, indicates which callbacks are used by a vehicle.
   222  * Some callbacks are always used and don't have a mask.
   217  * Some callbacks are always used and don't have a mask.