I created in my trainset special kind of passenger cars - restaurant car. According to my idea, this car should increase cargo_age_period for all other passenger cars in the consist. I coded this idea using bitmask_consist_info.
At the first some definitions:
Code: Select all
#define VINFO_PASSENGER_WAGON 0
#define VINFO_LUGGAGE_WAGON 3
#define VINFO_RESTAURANT_WAGON 4
#define VINFO_WAGON_BONUS bitmask(VINFO_LUGGAGE_WAGON, VINFO_RESTAURANT_WAGON)
Code: Select all
item(FEAT_TRAINS, item_wrmnouz) {
property {
...
bitmask_vehicle_info: bitmask(VINFO_PASSENGER_WAGON, VINFO_RESTAURANT_WAGON);
}
}
Code: Select all
switch(FEAT_TRAINS, SELF, switch_cargo_age_period, bitmask_consist_info & VINFO_WAGON_BONUS) {
bitmask(VINFO_LUGGAGE_WAGON): return _cargo_age_period_luggage_value_;
bitmask(VINFO_RESTAURANT_WAGON): return _cargo_age_period_restaurant_value_;
bitmask(VINFO_LUGGAGE_WAGON, VINFO_RESTAURANT_WAGON): return _cargo_age_period_all_value_;
return _cargo_age_period_normal_value_;
}
How it is possible? When the switch cargo_age_period is triggered?
I checked expression (bitmask_consist_info & VINFO_WAGON_BONUS) using different sprites for passenger cars and it works - all passenger cars "see" the restaurant car flags wherever he is.
Here is screenshot from tests. All trains are identical except position of the restaurant car. You can see different incomes: