Skip to content

Fix misuse of constants - #2950

Open
riccardobl wants to merge 1 commit into
jMonkeyEngine:masterfrom
riccardobl:fixmutv
Open

Fix misuse of constants#2950
riccardobl wants to merge 1 commit into
jMonkeyEngine:masterfrom
riccardobl:fixmutv

Conversation

@riccardobl

Copy link
Copy Markdown
Member

This PR fixes several cases of constants misuse that could end up being mutated, and one case where the code used the wrong constant.

Since passing references is often intentional in jme, I made sure to clone objects only when passing a reference was already causing the internal state to break.

quadrant = ic.readShort("quadrant", (short)0);
stepScale = (Vector3f) ic.readSavable("stepScale", Vector3f.UNIT_XYZ);
offset = (Vector2f) ic.readSavable("offset", Vector3f.UNIT_XYZ);
offset = (Vector2f) ic.readSavable("offset", Vector2f.ZERO);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Won't this case represent a radical change? After all, the value used to be (1, 1, 1), whereas now it is (0, 0, 0)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was likely a bug, because the writer defaults to ZERO

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.

2 participants