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

Change: add vehicle 'refit' callback (cb 0x163) and cargo class filter prop (0x28 for trains etc) #344

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andythenorth
Copy link
Contributor

@glx22
Copy link
Contributor

glx22 commented Nov 17, 2024

And the props ?

@andythenorth
Copy link
Contributor Author

And the props ?

OpenTTD PR might be split, so I thought two nml PRs maybe? :)

@andythenorth
Copy link
Contributor Author

13090 is merged including props and cb. I'll do the nml as a single PR.

wiki-backend bot pushed a commit to OpenTTD/wiki-data that referenced this pull request Nov 23, 2024
@andythenorth
Copy link
Contributor Author

Added glx22@411fe82

@andythenorth andythenorth changed the title Change: add vehicle 'refit' callback (cb 0x163) Change: add vehicle 'refit' callback (cb 0x163) and cargo class filter prop (0x28 for trains etc) Nov 23, 2024
@andythenorth
Copy link
Contributor Author

andythenorth commented Nov 24, 2024

Have tested the static prop, appears to work. Iron Horse nfo output from nmlc appears correct.

Train nml:

refittable_cargo_classes: [bitmask(6), bitmask(1, 7, 9)];

Action 0 prop output:

28 \wx0040
32 \wx0282

Comment on lines 62 to 63
"CC_POTABLE" : 13,
"CC_NON_POTABLE" : 14,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these don't belong in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I failed to branch something correctly, will adjust now.

@andythenorth
Copy link
Contributor Author

nml docs for the callback can be adapted from the nfo docs: https://newgrf-specs.tt-wiki.net/wiki/Callbacks#Custom_refit_.28163.29

LordAro
LordAro previously approved these changes Dec 1, 2024
@@ -605,7 +628,7 @@ def prop23_test(value):
"retire_early": {"size": 1, "num": 0x16},
"misc_flags": {"size": 1, "num": 0x17},
"refittable_cargo_classes": [{"size": 2, "num": 0x18}, zero_refit_mask(0x11)],
"non_refittable_cargo_classes": [{"size": 2, "num": 0x19}, zero_refit_mask(0x11)],
"non_refittable_cargo_classes": refittable_cargo_classes(0x19, 0x25, 0x11),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be on refittable_cargo_classes instead of non_refittable_cargo_classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a method call now refittable_cargo_classes()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you need a picture.

All other cases:

image

This case:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pictures are best
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so in the case of ships, the refittable_cargo_classes() function is used for the non_refittable_cargo_classes property.

For trains, road vehicles and aircraft, the refittable_cargo_classes() function is used for the refittable_cargo_classes property.

Maybe ships are special.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely my mistake (it's my code)

@@ -605,7 +628,7 @@ def prop23_test(value):
"retire_early": {"size": 1, "num": 0x16},
"misc_flags": {"size": 1, "num": 0x17},
"refittable_cargo_classes": [{"size": 2, "num": 0x18}, zero_refit_mask(0x11)],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"refittable_cargo_classes": [{"size": 2, "num": 0x18}, zero_refit_mask(0x11)],
"refittable_cargo_classes": refittable_cargo_classes(0x18, 0x25, 0x11),
"non_refittable_cargo_classes": [{"size": 2, "num": 0x19}, zero_refit_mask(0x11)],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants