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

Cleanup: Remove questionable syntax #7370

Merged
merged 5 commits into from Mar 13, 2019

Conversation

@Eddi-z
Copy link
Contributor

Eddi-z commented Mar 12, 2019

No description provided.

@Eddi-z Eddi-z force-pushed the Eddi-z:rating_calc branch from e5e5f0f to f894436 Mar 12, 2019
@Eddi-z Eddi-z changed the title Cleanup: Remove questionable syntax in station rating calculation Cleanup: Remove questionable syntax Mar 12, 2019
@nielsmh

This comment has been minimized.

Copy link
Contributor

nielsmh commented Mar 12, 2019

That's some amazingly bad syntax. Is that from the dawn of time?

@Eddi-z Eddi-z force-pushed the Eddi-z:rating_calc branch 2 times, most recently from a0b25ce to 633bb92 Mar 12, 2019
@Eddi-z

This comment has been minimized.

Copy link
Contributor Author

Eddi-z commented Mar 12, 2019

i'm not 100% convinced that the track one is really the best/clearest approach to this

That's some amazingly bad syntax. Is that from the dawn of time?

i'm fairly sure that's from r1.
and it probably makes perfect sense if you're reading assembler code and translating that into C code. but if you're reading this with an "if X then do Y" mindset, the conditions are all backwards and confusing.

Copy link
Contributor

M3Henry left a comment

This looks like mixed code and data. I would use an array of score-boundaries and use std::lower_bound to figure out the offset of val.

@nielsmh

This comment has been minimized.

@Eddi-z Eddi-z force-pushed the Eddi-z:rating_calc branch from 3c0a2d5 to 11ef52d Mar 12, 2019
@Eddi-z

This comment has been minimized.

Copy link
Contributor Author

Eddi-z commented Mar 12, 2019

skipped the track one for now, as probably a more involved rewrite might be in order there

src/order_gui.cpp Outdated Show resolved Hide resolved
@Eddi-z Eddi-z force-pushed the Eddi-z:rating_calc branch from 11ef52d to 1b20be4 Mar 12, 2019
@Eddi-z Eddi-z force-pushed the Eddi-z:rating_calc branch from 1b20be4 to d9123d2 Mar 12, 2019
src/rail_cmd.cpp Outdated Show resolved Hide resolved
src/rail_cmd.cpp Outdated Show resolved Hide resolved
@Eddi-z Eddi-z force-pushed the Eddi-z:rating_calc branch from c114017 to c30b07b Mar 12, 2019
@PeterN
PeterN approved these changes Mar 12, 2019
@PeterN PeterN merged commit 43ced57 into OpenTTD:master Mar 13, 2019
8 checks passed
8 checks passed
OpenTTD CI Build #20190312.17 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.8) Linux linux-amd64-clang-3.8 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.