Please correct me, if I'm wrong.
I checked NewGRF documentation and I found interesting information.
Variable Consist cargo (42) available in VarAction2 contains four subvariables. One of interesting data is the result of OR-ing custom bits from all vehicles in the train (in NML: bitmask_consist_info). But this variable can be read in two modes - 81 (vehicle) and 82 (engine).
If I good understand, NML variable bitmask_consist_info with PARENT scope returns bitmask for whole train, but the same variable witch SELF scope returns bitmask info for current vehicle only? Is it something like reading bitmask_vehicle_info, which is write-only property?
It will be very usefull discovery for me.
In some cases it can be easier to manage vehicle groups using vehicle custom bits instead of checking list of vehicle ids.
Code: Select all
switch(FEAT_TRAINS, SELF, switch_can_attach, hasbit(bitmask_consist_info, PASSENGER_COACH)) {
1: return CB_RESULT_ATTACH_ALLOW;
return string(STR_YOU_CAN_ATTACH_ONLY_PASSENGER_COACHES);
}