The idea is such that a refit between, say, coal and ore doesn't need any work in a depot and refit can be done at the station, just loading the other cargo type (either automatically what is available or explicitly chosen via the order). This becomes possible when both, the misc_flag is set and refit costs are 0 (either via property or callback) or when the refit_cost callback returns a value with bit 14 set which allows refit at a station with arbitrary costs.
The current cargo classes, cargo types and cargo subtypes are accessible by the usual variables, the new cargo classess (cccc), cargo subtype (ss) and cargo type (tt) are available via extra_callback_info1 (var 0x10) in the form of ccccsstt.
As such vehicle set authors probably want to update their sets and make use of this new misc_flag and the related callback.
Example code from OpenGFX+Trains looks like this:
Code: Select all
// Carrying vehicles needs special equipment. Changing from that to other transport types
// needs a depot visit. Different vehicle types need no change and are fine to be changed
// in a station w/o cost and trouble. Mask only the cargo type and mask out cargo classes and subtypes
switch (FEAT_TRAINS, SELF, flatbed_wagon_refit_from_vehicles, extra_callback_info1 & 0xFF) {
FMSP: return 0 | CB_RESULT_AUTOREFIT;
ENSP: return 0 | CB_RESULT_AUTOREFIT;
VEHI: return 0 | CB_RESULT_AUTOREFIT;
return CB_FAILED;
}
// Carrying containers requires stakes to be removed. This needs a depot visit. Changing
// one container for the other incurs no cost nor needs a depot visit.
switch (FEAT_TRAINS, SELF, flatbed_wagon_refit_from_flat, extra_callback_info1 & 0xFF) {
GOOD: return 0 | CB_RESULT_AUTOREFIT;
return CB_FAILED;
}
// Being a stake wagon is default. Allow refit without trouble and cost. Other versions
// need a depot visit
switch (FEAT_TRAINS, SELF, flatbed_wagon_refit_from_stakes, extra_callback_info1 & 0xFF) {
FMSP: return CB_FAILED;
ENSP: return CB_FAILED;
VEHI: return CB_FAILED;
GOOD: return CB_FAILED;
return 0 | CB_RESULT_AUTOREFIT;
}
switch (FEAT_TRAINS, SELF, flatbed_wagon_refit_cost_switch, cargo_type_in_veh) {
FMSP: flatbed_wagon_refit_from_vehicles;
ENSP: flatbed_wagon_refit_from_vehicles;
VEHI: flatbed_wagon_refit_from_vehicles;
GOOD: flatbed_wagon_refit_from_flat;
flatbed_wagon_refit_from_stakes;
}
item(FEAT_TRAINS, flatbed_wagon) {
property {
(...)
refit_cost: 40; // default value;
}
graphics {
(...)
refit_cost: flatbed_wagon_refit_cost_switch;
(...)
}