forked from OpenTTD/nml
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: expressions in random_switch cases should use the parent/self-sc…
…ope of the random_switch. Regular switches already behaved this way. For random_switches with BACKWARD/FORWARD-scope there is no sane behavior, but these scopes are pretty useless anyway.
- Loading branch information
Showing
5 changed files
with
199 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
grf { | ||
grfid: "NML\35"; | ||
name: string(STR_REGRESSION_NAME); | ||
desc: string(STR_REGRESSION_DESC); | ||
version: 0; | ||
min_compatible_version: 0; | ||
} | ||
|
||
random_switch(FEAT_INDUSTRYTILES, SELF, random1, bitmask(TRIGGER_INDUSTRYTILE_TILELOOP)) { | ||
2: relative_x < 2; | ||
1: relative_y > 5; | ||
} | ||
|
||
switch(FEAT_INDUSTRYTILES, SELF, var1, town_zone) { | ||
0: relative_x < 2; | ||
default: relative_y > 5; | ||
} | ||
|
||
random_switch(FEAT_INDUSTRYTILES, PARENT, random2, bitmask(TRIGGER_INDUSTRYTILE_TILELOOP)) { | ||
2: founder_colour1 < 2; | ||
1: founder_colour2 > 5; | ||
} | ||
|
||
switch(FEAT_INDUSTRYTILES, PARENT, var2, production_level) { | ||
0: founder_colour1 < 2; | ||
default: founder_colour2 > 5; | ||
} | ||
|
||
item(FEAT_INDUSTRYTILES, coal_mine) { | ||
property { | ||
substitute: 0; | ||
override: 0; | ||
} | ||
graphics { | ||
foundations: random1; | ||
autoslope: random2; | ||
anim_speed: var1; | ||
anim_control: var2; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
// Automatically generated by GRFCODEC. Do not modify! | ||
// (Info version 32) | ||
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>> | ||
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C | ||
// Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D% | ||
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags | ||
|
||
0 * 4 \d20 | ||
|
||
1 * 54 14 "C" "INFO" | ||
"B" "VRSN" \w4 \dx00000000 | ||
"B" "MINV" \w4 \dx00000000 | ||
"B" "NPAR" \w1 00 | ||
"B" "PALS" \w1 "A" | ||
"B" "BLTR" \w1 "8" | ||
00 | ||
00 | ||
2 * 52 08 08 "NML\35" "NML regression test" 00 "A test newgrf testing NML" 00 | ||
// Name: @return_action_0 | ||
3 * 34 02 09 FF 89 | ||
43 20 \dx000000FF | ||
\2cmp 1A 20 \dx00000002 | ||
\2< 1A 20 \dx00000001 | ||
\2^ 1A 00 \dx00000001 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: @return_action_1 | ||
4 * 34 02 09 FE 89 | ||
43 28 \dx000000FF | ||
\2cmp 1A 20 \dx00000005 | ||
\2- 1A 20 \dx00000001 | ||
\2> 1A 00 \dx00000000 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: random1 | ||
5 * 15 02 09 FE 80 01 \b0 04 | ||
\wx00FF \wx00FF \wx00FF // (2/3) -> (3/4): return (var[0x43, 0, 255] < 2) | ||
\wx00FE // (1/3) -> (1/4): return (var[0x43, 8, 255] > 5) | ||
|
||
// Name: @return_action_0 | ||
6 * 34 02 09 FF 89 | ||
43 20 \dx000000FF | ||
\2cmp 1A 20 \dx00000002 | ||
\2< 1A 20 \dx00000001 | ||
\2^ 1A 00 \dx00000001 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: @return_action_1 | ||
7 * 34 02 09 FD 89 | ||
43 28 \dx000000FF | ||
\2cmp 1A 20 \dx00000005 | ||
\2- 1A 20 \dx00000001 | ||
\2> 1A 00 \dx00000000 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: var1 | ||
8 * 23 02 09 FD 89 | ||
42 00 \dx00000007 | ||
\b1 | ||
\wx00FF \dx00000000 \dx00000000 // 0 .. 0: return (var[0x43, 0, 255] < 2) | ||
\wx00FD // default: return (var[0x43, 8, 255] > 5) | ||
|
||
// Name: @return_action_2 | ||
9 * 34 02 09 FF 8A | ||
45 38 \dx0000000F | ||
\2cmp 1A 20 \dx00000002 | ||
\2< 1A 20 \dx00000001 | ||
\2^ 1A 00 \dx00000001 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: @return_action_3 | ||
10 * 34 02 09 FC 8A | ||
45 3C \dx0000000F | ||
\2cmp 1A 20 \dx00000005 | ||
\2- 1A 20 \dx00000001 | ||
\2> 1A 00 \dx00000000 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: random2 | ||
11 * 15 02 09 FC 83 01 \b0 04 | ||
\wx00FF \wx00FF \wx00FF // (2/3) -> (3/4): return (var[0x45, 24, 15] < 2) | ||
\wx00FC // (1/3) -> (1/4): return (var[0x45, 28, 15] > 5) | ||
|
||
// Name: @return_action_0 | ||
12 * 34 02 09 FF 8A | ||
45 38 \dx0000000F | ||
\2cmp 1A 20 \dx00000002 | ||
\2< 1A 20 \dx00000001 | ||
\2^ 1A 00 \dx00000001 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: @return_action_1 | ||
13 * 34 02 09 FB 8A | ||
45 3C \dx0000000F | ||
\2cmp 1A 20 \dx00000005 | ||
\2- 1A 20 \dx00000001 | ||
\2> 1A 00 \dx00000000 | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: var2 | ||
14 * 23 02 09 FB 8A | ||
93 00 \dx000000FF | ||
\b1 | ||
\wx00FF \dx00000000 \dx00000000 // 0 .. 0: return (var[0x45, 24, 15] < 2) | ||
\wx00FB // default: return (var[0x45, 28, 15] > 5) | ||
|
||
15 * 11 00 09 \b2 01 FF \wx0000 | ||
08 00 | ||
09 00 | ||
|
||
16 * 9 00 09 \b1 01 FF \wx0000 | ||
0E 62 | ||
|
||
// Name: @CB_FAILED_LAYOUT09 | ||
17 * 17 02 09 FF \b0 \dx00000000 | ||
\dx00000000 \b0 \b0 \b0 \b0 \b0 | ||
// Name: @CB_FAILED09 | ||
18 * 23 02 09 FF 89 | ||
0C 00 \dx0000FFFF | ||
\b1 | ||
\wx8000 \dx00000000 \dx00000000 // graphics callback -> return 0 | ||
\wx00FF // Non-graphics callback, return graphics result | ||
|
||
// Name: @action3_0 | ||
19 * 53 02 09 FF 89 | ||
0C 00 \dx0000FFFF | ||
\b4 | ||
\wx00FB \dx00000025 \dx00000025 // var2; | ||
\wx00FD \dx00000027 \dx00000027 // var1; | ||
\wx00FE \dx00000030 \dx00000030 // random1; | ||
\wx00FC \dx0000003C \dx0000003C // random2; | ||
\wx00FF // @CB_FAILED09; | ||
|
||
20 * 7 03 09 01 00 \b0 | ||
\wx00FF // @action3_0; | ||
|