- 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;
- }
- // downgrade gen4->gen3 to fix initial randomness
- random_switch(FEAT_, SELF, randdown4, bitmask(TRIGGER_VEHICLE_SERVICE)){
- dependent: randup4;
- 4:generation3;
- }
- // gen4 already available?
- switch(FEAT_, SELF, testdown4, current_year){
- 0..(YEAR_GEN4-1):randdown4;
- default:generation4;
- }
- // at least gen3, already upgraded to gen4?
- random_switch(FEAT_, SELF, maybegen4){
- dependent: randup4;
- 3:testup4;
- 1:testdown4;
- }
- // 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;
- }
- // downgrade gen3->gen2 to fix initial randomness
- random_switch(FEAT_, SELF, randdown3, bitmask(TRIGGER_VEHICLE_SERVICE)){
- dependent: randup3;
- 4:generation2;
- }
- // gen3 already available?
- switch(FEAT_, SELF, testdown3, current_year){
- 0..(YEAR_GEN3-1):randdown3;
- default:maybegen4;
- }
- // at least gen2, already upgraded to gen3?
- random_switch(FEAT_, SELF, maybegen3){
- dependent: randup3;
- 3:testup3;
- 1:testdown3;
- }
- // 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;
- }
- // downgrade gen2->gen1 to fix initial randomness
- random_switch(FEAT_, SELF, randdown2, bitmask(TRIGGER_VEHICLE_SERVICE)){
- dependent: randup2;
- 4:generation1;
- }
- // gen2 already available?
- switch(FEAT_, SELF, testdown2, current_year){
- 0..(YEAR_GEN2-1):randdown2;
- default:maybegen3;
- }
- // at least gen1, already upgraded to gen2?
- random_switch(FEAT_, SELF, maybegen2){
- dependent: randup2;
- 3:testup2;
- 1:testdown2;
- }
- // 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;
- }