-
Notifications
You must be signed in to change notification settings - Fork 291
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
Aero/Squadrons: various changes #4800
Conversation
@@ -218,7 +218,8 @@ | |||
} | |||
} | |||
|
|||
Image img = bestMatch.getImage(comp, hex.getCoords().hashCode()); | |||
Random random = new Random(hex.getCoords().hashCode()); | |||
Image img = bestMatch.getImage(comp, Math.abs(random.nextInt() * random.nextInt())); |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null Warning
bestMatch
this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this null actually possible here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only when there are no base images in the tileset or it didnt load, so only when things are very bad. I'd say this can stay as it was (its the bestMatch.getImage() call and used to be like that before)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a little cleanup.
// Transporting | ||
if (!entity.getLoadedUnits().isEmpty()) { | ||
// Transporting (but not Squadrons that are obviously composed of subunits) | ||
if (!entity.getLoadedUnits().isEmpty() && !(entity instanceof FighterSquadron)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may as well use "isSquadron" here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
@@ -218,7 +218,8 @@ | |||
} | |||
} | |||
|
|||
Image img = bestMatch.getImage(comp, hex.getCoords().hashCode()); | |||
Random random = new Random(hex.getCoords().hashCode()); | |||
Image img = bestMatch.getImage(comp, Math.abs(random.nextInt() * random.nextInt())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this null actually possible here?
Very sorry, this actually needed a bit more cleanup. I added positioning for squadrons of up to 10 fighters, disallowed icon export for fsq in the lobby with a specific camo (doesnt work with the new icons) and added a static constructor for EntityImage. Aaaah and I'll need to check if this affects MHQ. Not quite there yet! |
OK, I added the constructors back in EntityImage for MHQ. Now it should be good (or at least better) |
This PR makes the following changes: