Skip to content

Commit

Permalink
Fix: Badge table should be defined before it is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterN committed Jan 19, 2025
1 parent df390e8 commit 751e07b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions regression/042_badges.nml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ grf {
min_compatible_version: 0;
}

switch (FEAT_TRAINS, SELF, sw_can_attach_wagon, has_badge("power/steam")) {
1: return CB_RESULT_ATTACH_ALLOW;
return string(STR_NO_BADGE);
}

badgetable {
"flag/GB",
"flag/US",
Expand All @@ -19,6 +14,11 @@ badgetable {
"power/electric",
}

switch (FEAT_TRAINS, SELF, sw_can_attach_wagon, has_badge("power/electric")) {
1: return CB_RESULT_ATTACH_ALLOW;
return string(STR_NO_BADGE);
}

item (FEAT_TRAINS, default_train, 8) {
property {
badges: ["flag/GB", "power/steam"];
Expand Down
Binary file modified regression/expected/042_badges.grf
Binary file not shown.
10 changes: 5 additions & 5 deletions regression/expected/042_badges.nfo
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
2 * 52 08 08 "NML\42" "NML regression test" 00 "A test newgrf testing NML" 00
3 * 43 04 00 FF 01 \wxD000 "Can only attach power/steam vehicles" 00

4 * 64 00 08 \b1 05 FF \wx0000
18 "flag/GB" 00 "flag/US" 00 "power/steam" 00 "power/diesel" 00 "power/electric" 00

// Name: sw_can_attach_wagon
4 * 24 02 00 FF 89
7A 02 00 \dx00000001
5 * 24 02 00 FF 89
7A 04 00 \dx00000001
\b1
\wx8401 \dx00000001 \dx00000001 // 1 .. 1: return 1025;
\wx8000 // default: return string(STR_NO_BADGE);

5 * 64 00 08 \b1 05 FF \wx0000
18 "flag/GB" 00 "flag/US" 00 "power/steam" 00 "power/diesel" 00 "power/electric" 00

6 * 14 00 00 \b1 01 FF \wx0008
33 \wx0002
\wx0000 \wx0002
Expand Down

0 comments on commit 751e07b

Please sign in to comment.