-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
wrong export if enum as flags have more than 30 values #3658
Comments
When describing that something is wrong, you should really specify in what way it's wrong. In this case, the value is always output as This issue affects TMX/TSX as well, not just JSON, and it affects saved files too, not just exports. As for "why" - the choice to use 32-bit or 64-bit ints is not to do with architecture - 32-bit machines can work with 64-bit ints and vice versa. Rather, 32-bit ints are simply a very safe choice for bit fields, they are supported by the vast majority of programming and scripting languages - some scripting languages in particular only support floating points, and even when those have the same number of bits as a 64-bit int, they cannot represent the same data reliably. For example, in JavaScript, |
output not always 0. |
Oh, can you provide some examples then (inputs in Tiled vs output in the file)? When I tried it, I always got 0 in both JSON and XML. I didn't try every possible combination of flags, but I tried a bunch, including both the high and low bits. |
Try add or remove 31 or 32 value when enum assigned to object. But I think it's unnecessary, because it's a overflow. Maybe there is signed integer type as storage. You have to look into the source code. |
I did that, I always got Unfortunately I got lost in my attempt xP It seems like when stored as numbers rather than strings, the |
I've done a short attempt at switching the stored value in the I'm afraid that changing the code to support 32 flag values is going to be a little bit tricky (and would also mean introducing an unsigned int property type), so I'd first of all fix this by reducing the values limit applied by the UI from 32 to 30. |
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 mapeditor#3658
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 mapeditor#3658
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 mapeditor#3658
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
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
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 #3658
Describe the bug
If add more than 30 values (31 or 32) to enum when checked "Allow multiple values" (act ass flags) exported to json values are wrong.
There is possible overflow on 30 bit.
Question
Why only 32 values if we have today 64 bit computers? Is there any masochist here who programs games on 32 bit windows? 😏
To Reproduce
Expected behavior
right export or unable to add more than 30 values as flags
Specifications:
The text was updated successfully, but these errors were encountered: