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

@michicc michicc Mar 30, 2019

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

@PeterN PeterN Mar 30, 2019

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
@PeterN PeterN force-pushed the per-group-wagon-removal branch from 481ed27 to c1f356c Apr 10, 2019
@PeterN PeterN force-pushed the per-group-wagon-removal branch from c1f356c to 08d18c7 May 3, 2019
Copy link
Member

@LordAro LordAro left a comment

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

@andythenorth andythenorth commented Dec 25, 2020

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

@PeterN PeterN force-pushed the per-group-wagon-removal branch from 08d18c7 to 9ab09d9 Apr 6, 2021
@PeterN
Copy link
Member Author

@PeterN PeterN commented Apr 6, 2021

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

src/group_cmd.cpp Show resolved Hide resolved
@PeterN PeterN force-pushed the per-group-wagon-removal branch from 9ab09d9 to 1e36293 Apr 7, 2021
Copy link
Member

@LordAro LordAro left a comment

LGTM

@michicc michicc merged commit a05bc04 into OpenTTD:master Apr 22, 2021
12 checks passed
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

6 participants