- switch(FEAT_, SELF, generation4) ...
- switch(FEAT_, SELF, generation3) ...
- switch(FEAT_, SELF, generation2) ...
- switch(FEAT_, SELF, generation1) ...
- #define YEAR_GEN2 1930
- #define YEAR_GEN3 1960
- #define YEAR_GEN4 1990
- // upgrade gen3->gen4, using probability 1 in 4
- random_switch(FEAT_, SELF, randup4, bitmask(TRIGGER_VEHICLE_SERVICE)){
- 4:generation3;
- }
- // upgrade gen3->gen4 available?
- switch(FEAT_, SELF, testup4, current_year){
- 0..(YEAR_GEN4-1):generation3;
- default:randup4;
- }
- // at least gen3, already upgraded to gen4?
- random_switch(FEAT_, SELF, maybegen4){
- dependent: randup4;
- 3:testup4;
- 1:generation4;
- }
- // upgrade gen2->gen3, using probability 1 in 4
- random_switch(FEAT_, SELF, randup3, bitmask(TRIGGER_VEHICLE_SERVICE)){
- 4:generation2;
- }
- // upgrade gen2->gen3 available?
- switch(FEAT_, SELF, testup3, current_year){
- 0..(YEAR_GEN3-1):generation2;
- default:randup3;
- }
- // at least gen2, already upgraded to gen3?
- random_switch(FEAT_, SELF, maybegen3){
- dependent: randup3;
- 3:testup3;
- 1:maybegen4;
- }
- // upgrade gen1->gen2, using probability 1 in 4
- random_switch(FEAT_, SELF, randup2, bitmask(TRIGGER_VEHICLE_SERVICE)){
- 4:generation1;
- }
- // upgrade gen1->gen2 available?
- switch(FEAT_, SELF, testup2, current_year){
- 0..(YEAR_GEN2-1):generation1;
- default:randup2;
- }
- // at least gen1, already upgraded to gen2?
- random_switch(FEAT_, SELF, maybegen2){
- dependent: randup2;
- 3:testup2;
- 1:maybegen3;
- }
- // default generation by build-year
- switch(FEAT_, SELF, main_graphics, build_year){
- 0..(YEAR_GEN2-1): maybegen2
- YEAR_GEN2..(YEAR_GEN3-1): maybegen3
- YEAR_GEN3..(YEAR_GEN4-1): maybegen4
- default: generation4;
- }