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
Merged

Conversation

Eddi-z
Copy link
Contributor

@Eddi-z Eddi-z commented Mar 12, 2019

No description provided.

@Eddi-z Eddi-z changed the title Cleanup: Remove questionable syntax in station rating calculation Cleanup: Remove questionable syntax Mar 12, 2019
@nielsmh
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 rating_calc branch 2 times, most recently from a0b25ce to 633bb92 Compare March 12, 2019 13:50
@Eddi-z
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 M3Henry left a comment

Choose a reason for hiding this comment

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

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
Copy link
Contributor

nielsmh commented Mar 12, 2019

@Eddi-z
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
src/rail_cmd.cpp Outdated Show resolved Hide resolved
src/rail_cmd.cpp Outdated Show resolved Hide resolved
@PeterN PeterN merged commit 43ced57 into OpenTTD:master Mar 13, 2019
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

5 participants