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

Fixed the entry limit for enums used as flags to be 31 #3666

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

bjorn
Copy link
Member

@bjorn bjorn commented Apr 18, 2023

Due to the use of a 32-bit int to store the flags, the maximum number of flags is actually 30 rather than 32. When more entries are added, the editing of enum values breaks entirely.

The translations have been updated to use a parameter for the maximum number of flags in an enum, to make it easier to adjust this value when it might be increased in the future.

Closes #3658

@bjorn
Copy link
Member Author

bjorn commented May 11, 2023

As noted by @eishiya, the expected maximum number of supported flags is actually 31, so we still need to do some research on why the problems already start at 31 flags. The documentation added in 2a8fc6e should also be clarified, since contrary to what I wrote in the commit message, the value of the 31st flag should actually be 1073741824 (2^30), given that the 1st flag has value 1 (2^0).

Previously it could only handle 30 flags due to a check that was
done using signed integers.
This was already working, but the test is just making sure they are
indeed saved and loaded correctly.
@bjorn bjorn changed the title Fixed the entry limit for enums used as flags to be 30 Fixed the entry limit for enums used as flags to be 31 Aug 4, 2023
Due to the use of a 32-bit int to store the flags, the maximum number of
flags is actually 31 rather than 32. When more entries are added, the
editing of enum values breaks entirely.

The translations have been updated to use a parameter for the maximum
number of flags in an enum, to make it easier to adjust this value when
it might be increased in the future.

Closes mapeditor#3658
@bjorn bjorn merged commit 2990389 into mapeditor:master Aug 4, 2023
12 checks passed
@bjorn bjorn deleted the fix-flags-limit branch August 4, 2023 12:09
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.

wrong export if enum as flags have more than 30 values
1 participant