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

Add missing casts and remove FloatMath methods calls #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add missing casts and remove FloatMath methods calls #93

wants to merge 1 commit into from

Conversation

IriaSomobu
Copy link

This will remove compile errors on modern javac.

Note: android.util.FloatMath class was deprecated and all its methods was removed in API version 23 and above.

Also adding (Object) cast before bundle.getCollection() call will supress Incompatible types error in Android Studio.

Comment on lines 89 to 94
float a = i * 3.1415926f * 2 / nRays;
v[0] = FloatMath.cos( a ) * radius;
v[1] = FloatMath.sin( a ) * radius;
v[0] = (float)Math.cos( a ) * radius;
v[1] = (float)Math.sin( a ) * radius;
vertices.put( v );

a += 3.1415926f * 2 / nRays / 2;

Choose a reason for hiding this comment

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

Our static analysis engine detects that your pull request includes a change that uses the rough value of Math.PI. According to the best practice, it's recommended to use the predefined library constant for code clarity and better precision.

@LingASDJ
Copy link

Good,But The Pixel Dungeon Not Update.

@IriaSomobu
Copy link
Author

@LingASDJ yep, but maybe this code will help someone else

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.

None yet

3 participants