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

Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops #8438

Merged
merged 1 commit into from Dec 27, 2020

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Dec 27, 2020

Motivation / Problem

Continuing to reduce the number of FOR_XXX macro when it's possible (started in #7864)

Description

Implemented an iterator for OrderList inside Vehicle.
This iterator is written to support deletion of items during the iteration as RemoveOrderFromAllVehicles() can delete orders in the for loop.

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

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

Code looks good

src/vehicle_base.h Outdated Show resolved Hide resolved
src/vehicle_base.h Outdated Show resolved Hide resolved
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

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

I'm happy.

Might consider replacing the weird order list with a proper container at some point ;)

@LordAro LordAro merged commit d8605ad into OpenTTD:master Dec 27, 2020
@glx22 glx22 deleted the range_for branch December 27, 2020 10:35
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

2 participants