-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: register_map must be accessed with the feature of the action, no…
…t with the scope of the variables.
- Loading branch information
Showing
9 changed files
with
221 additions
and
21 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
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
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,34 @@ | ||
grf { | ||
grfid: "NML\36"; | ||
name: string(STR_REGRESSION_NAME); | ||
desc: string(STR_REGRESSION_DESC); | ||
version: 0; | ||
min_compatible_version: 0; | ||
} | ||
|
||
switch(FEAT_INDUSTRIES, SELF, dumb_add, a, b, a + b) { return; } | ||
|
||
/* some computation that requires registers for intermediate values */ | ||
switch(FEAT_INDUSTRIES, PARENT, callee, a, (population+(has_church?500:1))*(num_houses-4*has_stadium)+a) { | ||
0..5: return a + dumb_add(5, a); | ||
default: return a + dumb_add(6, a); | ||
} | ||
|
||
switch(FEAT_INDUSTRIES, SELF, caller2, dumb_add(1,dumb_add(founder_colour2, build_date))*(water_distance+founder_colour1)*(random_bits+callee(1))*(founder_type+layout_num)*(build_type+counter)) { | ||
return; | ||
} | ||
|
||
switch(FEAT_INDUSTRIES, SELF, caller1, (founder_colour2+build_date)*dumb_add(random_bits, callee(0))*(build_type+counter)) { | ||
return; | ||
} | ||
|
||
item(FEAT_INDUSTRIES, coal_mine) { | ||
property { | ||
substitute: INDUSTRYTYPE_COAL_MINE; | ||
override: INDUSTRYTYPE_COAL_MINE; | ||
} | ||
graphics { | ||
build_prod_change: return caller1; | ||
control_special: return caller2; | ||
} | ||
} |
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,162 @@ | ||
// 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 \d14 | ||
|
||
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\36" "NML regression test" 00 "A test newgrf testing NML" 00 | ||
// Name: dumb_add | ||
// a : register 8A | ||
// b : register 8B | ||
3 * 22 02 0A FF 89 | ||
7D 8A 20 \dxFFFFFFFF // a | ||
\2+ 7D 8B 00 \dxFFFFFFFF // b | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: @return_action_0 | ||
4 * 66 02 0A FE 8A | ||
1A 20 \dx00000005 | ||
\2sto 1A 20 \dx0000008A | ||
\2r 7D 88 20 \dxFFFFFFFF // a | ||
\2sto 1A 20 \dx0000008B | ||
\2r 7E FF 20 \dxFFFFFFFF // dumb_add(5, a) | ||
\2sto 1A 20 \dx00000089 | ||
\2r 7D 88 20 \dxFFFFFFFF // a | ||
\2+ 7D 89 00 \dxFFFFFFFF | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: @return_action_1 | ||
5 * 66 02 0A FD 8A | ||
1A 20 \dx00000006 | ||
\2sto 1A 20 \dx0000008A | ||
\2r 7D 88 20 \dxFFFFFFFF // a | ||
\2sto 1A 20 \dx0000008B | ||
\2r 7E FF 20 \dxFFFFFFFF // dumb_add(6, a) | ||
\2sto 1A 20 \dx00000089 | ||
\2r 7D 88 20 \dxFFFFFFFF // a | ||
\2+ 7D 89 00 \dxFFFFFFFF | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: callee | ||
// a : register 88 | ||
6 * 110 02 0A FD 8A | ||
92 22 \dx00000001 | ||
\2* 1A 20 \dx00000004 | ||
\2sto 1A 20 \dx00000089 | ||
\2r B6 20 \dx0000FFFF | ||
\2- 7D 89 20 \dxFFFFFFFF | ||
\2sto 1A 20 \dx0000008A | ||
\2r 92 21 \dx00000001 | ||
\2u< 1A 20 \dx00000001 | ||
\2* 1A 20 \dx000001F3 // expr1 - expr2 | ||
\2+ 1A 20 \dx00000001 | ||
\2+ 82 20 \dx0000FFFF | ||
\2* 7D 8A 20 \dxFFFFFFFF | ||
\2+ 7D 88 00 \dxFFFFFFFF // a | ||
\b1 | ||
\wx00FE \dx00000000 \dx00000005 // 0 .. 5: return (a + dumb_add(5, a)) | ||
\wx00FD // default: return (a + dumb_add(6, a)) | ||
|
||
// Name: caller2 | ||
7 * 230 02 0A FE 89 | ||
B3 20 \dx00000003 | ||
\2+ AA 20 \dx0000FFFF | ||
\2sto 1A 20 \dx00000080 | ||
\2r 45 30 \dx00000003 | ||
\2+ 44 20 \dx000000FF | ||
\2sto 1A 20 \dx00000081 | ||
\2r 1A 20 \dx00000001 | ||
\2sto 1A 20 \dx00000088 | ||
\2r 7E FD 20 \dxFFFFFFFF // callee(1) | ||
\2+ 5F 28 \dx0000FFFF | ||
\2sto 1A 20 \dx00000082 | ||
\2r 43 20 \dxFFFFFFFF | ||
\2+ 45 38 \dx0000000F | ||
\2sto 1A 20 \dx00000083 | ||
\2r 1A 20 \dx00000001 | ||
\2sto 1A 20 \dx00000086 | ||
\2r 45 3C \dx0000000F | ||
\2sto 1A 20 \dx0000008A | ||
\2r 46 20 \dxFFFFFFFF | ||
\2sto 1A 20 \dx0000008B | ||
\2r 7E FF 20 \dxFFFFFFFF // dumb_add(var[0x45, 28, 15], var[0x46, 0, -1]) | ||
\2sto 1A 20 \dx00000087 | ||
\2r 1A 20 \dx00000086 | ||
\2sto 1A 20 \dx0000008A | ||
\2r 1A 20 \dx00000087 | ||
\2sto 1A 20 \dx0000008B | ||
\2r 7E FF 20 \dxFFFFFFFF // dumb_add(1, dumb_add(var[0x45, 28, 15], var[0x46, 0, -1])) | ||
\2* 7D 83 20 \dxFFFFFFFF | ||
\2* 7D 82 20 \dxFFFFFFFF | ||
\2* 7D 81 20 \dxFFFFFFFF | ||
\2* 7D 80 00 \dxFFFFFFFF | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
// Name: caller1 | ||
8 * 143 02 0A FF 89 | ||
B3 20 \dx00000003 | ||
\2+ AA 20 \dx0000FFFF | ||
\2sto 1A 20 \dx00000080 | ||
\2r 5F 28 \dx0000FFFF | ||
\2sto 1A 20 \dx00000083 | ||
\2r 1A 20 \dx00000000 | ||
\2sto 1A 20 \dx00000088 | ||
\2r 7E FD 20 \dxFFFFFFFF // callee(0) | ||
\2sto 1A 20 \dx00000084 | ||
\2r 1A 20 \dx00000083 | ||
\2sto 1A 20 \dx0000008A | ||
\2r 1A 20 \dx00000084 | ||
\2sto 1A 20 \dx0000008B | ||
\2r 7E FF 20 \dxFFFFFFFF // dumb_add(var[0x5F, 8, 65535], callee(0)) | ||
\2sto 1A 20 \dx00000085 | ||
\2r 45 3C \dx0000000F | ||
\2+ 46 20 \dxFFFFFFFF | ||
\2* 7D 85 20 \dxFFFFFFFF | ||
\2* 7D 80 00 \dxFFFFFFFF | ||
\b0 | ||
\wx8000 // Return computed value | ||
|
||
9 * 11 00 0A \b2 01 FF \wx0000 | ||
08 00 | ||
09 00 | ||
|
||
10 * 11 00 0A \b2 01 FF \wx0000 | ||
21 00 | ||
22 42 | ||
|
||
// Name: @CB_FAILED_PROD | ||
11 * 15 02 0A FD 00 \wx0000 \wx0000 \wx0000 \wx0000 \wx0000 00 | ||
|
||
// Name: @CB_FAILED0A | ||
12 * 23 02 0A FD 89 | ||
0C 00 \dx0000FFFF | ||
\b1 | ||
\wx8000 \dx00000000 \dx00000000 // graphics callback -> return 0 | ||
\wx00FD // Non-graphics callback, return graphics result | ||
|
||
// Name: @action3_0 | ||
13 * 33 02 0A FD 89 | ||
0C 00 \dx0000FFFF | ||
\b2 | ||
\wx00FE \dx0000003B \dx0000003B // caller2; | ||
\wx00FF \dx0000015F \dx0000015F // caller1; | ||
\wx00FD // @CB_FAILED0A; | ||
|
||
14 * 7 03 0A 01 00 \b0 | ||
\wx00FD // @action3_0; | ||
|