Skip to content

Commit

Permalink
Added metro tram/train parameter switching
Browse files Browse the repository at this point in the history
  • Loading branch information
audigex committed Jun 2, 2024
1 parent 481022a commit 25439c3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions lang/english.lng
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ STR_TRAM_TRAINONLY :Display all Metro units as Trains only (no tra
STR_TRAM_TRAMONLY :Display all Metro Units as Trams only (no London Underground trains etc, only as trams)
STR_TRAM_BOTH :Display Trams and Trains as both Trams and Trains (all purchaseable as either)
STR_TRAM_EXTRA :Display as both AND include some extra heavy rail units (Thameslink, Crossrail etc)
STR_TRAM_SUPEREXTRA :(Experimental) Include a slightly ridiculous number of extra units (London Overground, trains used for suburban routes)

STR_PARAM_NAME_2CC :Parameter not in use (yet)
STR_PARAM_DESC_2CC :Parameter reserved for future feature
Expand Down
6 changes: 4 additions & 2 deletions src/grf.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,19 @@ grf {
name: string(STR_PARAM_NAME_TRAM);
desc: string(STR_PARAM_DESC_TRAM);
min_value: 0;
max_value: 3;
max_value: 5;
def_value: 1;
names: {
0: string(STR_TRAM_DEFAULT);
1: string(STR_TRAM_TRAINONLY);
2: string(STR_TRAM_TRAMONLY);
3: string(STR_TRAM_BOTH);
4: string(STR_TRAM_EXTRA);
5: string(STR_TRAM_SUPEREXTRA);
};
}
}
param 6 {
param 7 {
param_2cc{
name: string(STR_PARAM_NAME_2CC);
desc: string(STR_PARAM_DESC_2CC);
Expand Down
35 changes: 35 additions & 0 deletions src/metroparam_switch.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 0 : DEFAULT : (Default) Realistic Heavy/Light rail split (Trams and light rail as trams, heavy rail as trains)
// 1 : TRAINONLY : Display all Metro units as Trains only (no trams)
// 2 : TRAMONLY : Display all Metro Units as Trams only (no London Underground trains etc, only as trams)
// 3 : BOTH : Display Trams and Trains as both Trams and Trains (all purchaseable as either)
// 4 : EXTRA : Display as both AND include some extra heavy rail units (Thameslink, Crossrail etc)
// 5 : SUPEREXTRA : (Experimental) Include a slightly ridiculous number of extra units (London Overground, trains used for suburban routes)

if (param[6] < 5) {
// Disable "SUPEREXTRA" tram units at 5 or any setting below 5


}

if (param[6] < 4) {
// Disable "EXTRA" tram units at 4 or any setting below 4
}

// Do nothing when set to 3 specifically, "EXTRA" and "SUPEREXTRA" will already be removed above
// and BOTH includes both tram and train versions so there's nothing to disable

if (param[6] == 2) { // TRAM
// Disable train versions of all metro units
}

if (param[6] == 1) { // TRAIN
// Disable train versions of all metro units
disable_item(FEAT_TRAINS, 595); // London Underground 2024 stock tram
}

if (param[6] == 0) { // DEFAULT
// Disable tram versions of heavy rail units
disable_item(FEAT_ROADVEHS, 595); // London Underground 2024 stock tram

// Disable train versions of light rail versions
}

0 comments on commit 25439c3

Please sign in to comment.