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

Add: allow use of switches and random switches as procedures #66

Merged
merged 7 commits into from Dec 29, 2019

Conversation

@glx22
Copy link
Contributor

glx22 commented Nov 24, 2019

NFO output seems correct, but ID handling and generation needs work. For now 2 different procedures can have the same ID.
Work probably needed in other areas too. That's why it's a draft.

Feel free to add commits in my branch.

@glx22 glx22 force-pushed the glx22:procedure branch 5 times, most recently from 4430190 to 4828210 Nov 25, 2019
@glx22 glx22 force-pushed the glx22:procedure branch from 065f92a to 35d8551 Dec 9, 2019
@andythenorth
Copy link
Contributor

andythenorth commented Dec 15, 2019

I've tested this with a single stored procedure in Iron Horse.
Branch is https://github.com/andythenorth/iron-horse/tree/stored-procedure-test-haulage-speed-bonus

This replaces global-switch-and-registers with checking a procedure result. It makes more readable code. It's not a very interesting test case but eh. Appears to work.

@glx22 glx22 marked this pull request as ready for review Dec 18, 2019
@glx22
Copy link
Contributor Author

glx22 commented Dec 18, 2019

I think it's ready now.

@glx22 glx22 force-pushed the glx22:procedure branch from 35d8551 to f899496 Dec 18, 2019
@glx22 glx22 force-pushed the glx22:procedure branch from f899496 to a4ab9ab Dec 19, 2019
nml/expression/array.py Outdated Show resolved Hide resolved
nml/expression/bitmask.py Outdated Show resolved Hide resolved
@andythenorth
Copy link
Contributor

andythenorth commented Dec 29, 2019

One final +1: I have converted Iron Horse to use procedures widely, and have compiled hundreds of times now using nmlc built with this PR. Zero issues so far.

@LordAro LordAro merged commit 862c1c3 into OpenTTD:master Dec 29, 2019
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:procedure branch Dec 29, 2019
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

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