Callback: Refit cost factor

From GRFSpecs
Jump to navigationJump to search

Refit cost factor (15E)

This callback can be used to override the refit cost property of vehicles. This callback will also be called in purchase list scope, so either limit the used variables to what is available in the purchase list or branch on the special purchase list cargo type.

Variable 10 contains information about the target cargo type similar to variable 47.

Format: ccccwwtt

Variable Value
tt The cargo type being refitted to; translated if a translation table has been installed
ww Subtype being refitted to
cccc The cargo class value of the cargo being refitted to


Return values:

  • Bits 0-13: Signed refit cost factor, cost base depends on the vehicle type and is the same as for the refit cost property. Negative cost factors allow refit revenue.
  • Bit 14: If set, the refit is allowed as an auto-refit as long as bit 4 of the miscellaneous flags is set as well.

Do not allow autorefit if the length of the vehicle will change (e.g. using cb36 to set length). Vehicle length may not change in stations.

If the callback fails, the value of the refit cost property is used.