Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Engine name callback #276

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions nml/actions/action0.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,10 @@ def parse_sort_block(feature, vehid_list):


callback_flag_properties = {
0x00: {"size": 1, "num": 0x1E},
0x01: {"size": 1, "num": 0x17},
0x02: {"size": 1, "num": 0x12},
0x03: {"size": 1, "num": 0x14},
0x00: two_byte_property(0x1E, 0x31),
0x01: two_byte_property(0x17, 0x28),
0x02: two_byte_property(0x12, 0x22),
0x03: two_byte_property(0x14, 0x22),
0x04: {"size": 1, "num": 0x0B},
0x05: {"size": 1, "num": 0x08},
0x07: two_byte_property(0x14, 0x1D),
Expand Down Expand Up @@ -1119,11 +1119,9 @@ def get_callback_flags_actions(feature, id, flags):
if not isinstance(prop_info_list, list):
prop_info_list = [prop_info_list]
for prop_info in prop_info_list:
act0.prop_list.append(
Action0Property(
prop_info["num"], parse_property_value(prop_info, expression.ConstantNumeric(flags)), prop_info["size"]
)
)
parsed_value = parse_property_value(prop_info, expression.ConstantNumeric(flags))
if parsed_value[0].value != 0:
act0.prop_list.append(Action0Property(prop_info["num"], parsed_value, prop_info["size"]))

return [act0]

Expand Down
1 change: 1 addition & 0 deletions nml/actions/action3_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'every_32_days' : {'type': 'cb', 'num': 0x32},
'sound_effect' : {'type': 'cb', 'num': 0x33, 'flag_bit': 7},
'refit_cost' : {'type': 'cb', 'num': 0x15E, 'purchase': 1},
'name' : {'type': 'cb', 'num': 0x161, 'flag_bit': 8, 'purchase': 2},
}

# Function to convert vehicle length to the actual property value, which is (8 - length)
Expand Down
Binary file modified regression/expected/030_house.grf
Binary file not shown.
12 changes: 4 additions & 8 deletions regression/expected/030_house.nfo
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,8 @@ FF
\b2
02 03

48 * 11 00 07 \b2 01 FF \wx0000
48 * 9 00 07 \b1 01 FF \wx0000
14 03
1D 00

// Name: @action3_0
49 * 57 02 07 FD 89
Expand All @@ -328,9 +327,8 @@ FF
51 * 7 03 07 01 00 \b0
\wx00FD // @action3_0;

52 * 11 00 07 \b2 01 FF \wx0001
52 * 9 00 07 \b1 01 FF \wx0001
14 02
1D 00

// Name: @action3_1
53 * 47 02 07 FD 89
Expand All @@ -347,9 +345,8 @@ FF
55 * 7 03 07 01 01 \b0
\wx00FD // @action3_1;

56 * 11 00 07 \b2 01 FF \wx0002
56 * 9 00 07 \b1 01 FF \wx0002
14 02
1D 00

// Name: @action3_2
57 * 47 02 07 FD 89
Expand All @@ -366,9 +363,8 @@ FF
59 * 7 03 07 01 02 \b0
\wx00FD // @action3_2;

60 * 11 00 07 \b2 01 FF \wx0003
60 * 9 00 07 \b1 01 FF \wx0003
14 02
1D 00

// Name: @action3_3
61 * 47 02 07 FF 89
Expand Down
Binary file modified regression/expected/033_procedure.grf
Binary file not shown.
3 changes: 1 addition & 2 deletions regression/expected/033_procedure.nfo
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ B3 20 \dx00000003
08 00
09 00

9 * 11 00 0A \b2 01 FF \wx0000
21 00
9 * 9 00 0A \b1 01 FF \wx0000
22 42

// Name: @CB_FAILED_PROD
Expand Down
Binary file modified regression/expected/039_storage.grf
Binary file not shown.
3 changes: 1 addition & 2 deletions regression/expected/039_storage.nfo
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
08 00
09 00

6 * 11 00 0A \b2 01 FF \wx0000
6 * 9 00 0A \b1 01 FF \wx0000
21 20
22 00

// Name: @CB_FAILED_PROD
7 * 15 02 0A FE 00 \wx0000 \wx0000 \wx0000 \wx0000 \wx0000 00
Expand Down