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

Feature: Per-group wagon removal flag #7441

Merged
merged 3 commits into from Apr 22, 2021

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Mar 30, 2019

Implements #5730.

Group::replace_protection is converted to a bitmap of flags.
Savegame conversion is there just to set the flag for existing groups for compatibility.

@@ -65,6 +65,7 @@ struct GroupStatistics {

enum GroupFlags : uint8 {
GF_REPLACE_PROTECTION, ///< If set to true, the global autoreplace has no effect on the group
GF_END,
Copy link
Member

Choose a reason for hiding this comment

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

Put in a comment that CmdSetGroupFlag is currently limited to 3 bits?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, yeah, this is wrong as I used GroupFlags as the storage type but the values within the enum are used to set bits. Perhaps it should be:

enum GroupFlag { ... }
typedef uint8 GroupFlags

or something.

src/saveload/saveload.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.

Conflict needs resolving, and I'd like to see the above comments addressed as well

src/script/api/script_group.cpp Outdated Show resolved Hide resolved
@LordAro LordAro added the stale Stale issues label Sep 24, 2020
@TrueBrain TrueBrain added candidate: yes This Pull Request is a candidate for being merged size: large This Pull Request is large in size; review will take a while and removed stale Stale issues labels Dec 14, 2020
@andythenorth
Copy link
Contributor

+1 to this one, I believe it's a straightforward improvement.

@PeterN
Copy link
Member Author

PeterN commented Apr 6, 2021

Resurrected. Storage type of group::flags is changed to uint8 as it is a bit-field, not directly GroupFlags.

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.

LGTM

@michicc michicc merged commit a05bc04 into OpenTTD:master Apr 22, 2021
@PeterN PeterN deleted the per-group-wagon-removal branch November 28, 2023 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate: yes This Pull Request is a candidate for being merged size: large This Pull Request is large in size; review will take a while
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants