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

@andythenorth andythenorth commented Feb 18, 2020

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

This comment has been minimized.

@frosch123

frosch123 Feb 18, 2020
Member

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.

This comment has been minimized.

@glx22

glx22 Feb 18, 2020
Author Contributor

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

This comment has been minimized.

@frosch123

frosch123 Feb 18, 2020
Member

good point, I forgot that :)

@andythenorth andythenorth merged commit 552af60 into OpenTTD:master Feb 18, 2020
12 checks passed
12 checks passed
Python 3.5 on ubuntu-latest
Details
Python 3.6 on ubuntu-latest
Details
Python 3.7 on ubuntu-latest
Details
Python 3.8 on ubuntu-latest
Details
Python 3.5 on macOS-latest
Details
Python 3.6 on macOS-latest
Details
Python 3.7 on macOS-latest
Details
Python 3.8 on macOS-latest
Details
Python 3.5 on windows-2016
Details
Python 3.6 on windows-2016
Details
Python 3.7 on windows-2016
Details
Python 3.8 on windows-2016
Details
@glx22 glx22 deleted the glx22:accepted_cargos branch Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.