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

Fix old tokens being given zero opacity when added to a campaign #3987

Merged

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented Apr 20, 2023

Identify the Bug or Feature request

#3986

Description of the Change

It used to be that Token.tokenOpacity would use the default value of 0 when an old token was loaded that didn't have the field. This would be modified into 1 so that the token would be opaque instead of transparent.

Now that we support real zero opacity, we need another default value so that we distinguish it. The field is now a Float instead of a float so that null is now the default, and a value of 0 can be relied on as meaning fully transparent. readResolve() is also now responsible for fixing up the opacity rather than leaving that for the getter.

Some cleanup is also included as getTokenOpacity() now longer needs to range-check the value, and we don't need a separate and public-facing setTokenOpacity() for string values.

Possible Drawbacks

None

Documentation Notes

N/A

Release Notes

N/A


This change is Reviewable

It used to be that `Token.tokenOpacity` would use the default value of `0` when an old token was loaded that didn't
have the field. This would be modified into `1` so that the token would be opaque instead of transparent.

Now that we support real zero opacity, we need another default value so that we distinguish it. The field is now a
`Float` instead of a `float` so that `null` is now the default, and a value of `0` can be relied on as meaning fully
transparent. `readResolve()` is also now responsible for fixing up the opacity rather than leaving that for the getter.

Some cleanup is also included as `getTokenOpacity()` now longer needs to range-check the value, and we don't need a
separate and public-facing `setTokenOpacity()` for string values.
@cwisniew cwisniew merged commit f8c384d into RPTools:release-1.13 Apr 21, 2023
@kwvanderlinde kwvanderlinde deleted the bugfix/3986-rptok-opacity-zero branch April 21, 2023 15:39
@cwisniew cwisniew added the bug label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants