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: industry tiles and houses now support 16 accepted cargos #85

Merged
merged 1 commit into from Feb 18, 2020

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Feb 17, 2020

No description provided.

@andythenorth
Copy link
Contributor

This PR adds the last thing needed for newgrf support of OpenTTD 1.9.0 :)

https://wiki.openttd.org/NewGRF_Specification_Status

if not isinstance(cargo_amount_pair, Array) or len(cargo_amount_pair.values) != 2:
raise generic.ScriptError("Each element of accepted_cargos must be an array with two elements: cargoid and amount", cargo_amount_pair.pos)
cargo_id = cargo_amount_pair.values[0].reduce_constant().value
cargo_amount = cargo_amount_pair.values[1].reduce_constant().value
Copy link
Member

Choose a reason for hiding this comment

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

How about a

 if isinstance(cargo_amount, ConstantNumeric):
        generic.check_range(cargo_amount.value, 0, 8, "cargo acceptance", cargo_amount.pos)

cargo_id could also be checked for range, but probably does not help much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for industry tiles it can be <0 to counter INDTILE_FLAG_ACCEPT_ALL effect

Copy link
Member

Choose a reason for hiding this comment

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

good point, I forgot that :)

@andythenorth andythenorth merged commit 552af60 into OpenTTD:master Feb 18, 2020
@glx22 glx22 deleted the accepted_cargos branch February 18, 2020 21:42
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.

None yet

3 participants