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

fighter squadron refactor #3006

Merged
merged 4 commits into from
Jul 12, 2021
Merged

Conversation

NickAragua
Copy link
Member

There are two components to this set of changes. One is the removal of the unnecessary and burdensome "Optional" in Entity.getSubEntities(). I like syntactic sugar as much as the next guy, but only if it actually reduces code volume or provides some other return on investment.

The second component is that all interactions within FighterSquadron that used the "fighters" list directly now use the getSubEntities() or getActiveSubEntities() methods instead, guaranteeing that the entities in question are never null, which is what caused #2988, #2989.

Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

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

Looks good, just some formatting quips.

if(te.getActiveSubEntities().orElse(Collections.emptyList()).isEmpty()) {
List<Entity> fighters = te.getActiveSubEntities();

if(fighters.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(fighters.isEmpty()) {
if (fighters.isEmpty()) {

megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/FighterSquadron.java Outdated Show resolved Hide resolved
NickAragua and others added 3 commits July 12, 2021 17:19
Co-authored-by: Justin Bowen <39067288+Windchild292@users.noreply.github.com>
Co-authored-by: Justin Bowen <39067288+Windchild292@users.noreply.github.com>
@NickAragua NickAragua merged commit bd981d2 into MegaMek:master Jul 12, 2021
@NickAragua NickAragua deleted the figher_squadron_rework branch July 12, 2021 21:23
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