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

Fixed #2878 Missing Bay Door on reload. #2879

Merged

Conversation

HoneySkull
Copy link
Collaborator

@HoneySkull HoneySkull commented Sep 19, 2021

Fixes #2878

Found and fixed an issue that occurs when a dropship bay door is scrapped and repaired. The MissingBayDoor::fix() method was removing itself prior to adding the actual part. The side-effect of the remove() function is that is renders this.parentPart null therefore unable to complete the critical next step of linking the child/parent relationship to the actual part.

I could have just moved the remove method below setting the actual part relationship, but thought this side effect needed to be documented here to make the reader of this code aware of the side effect.

The impact of the original code was that the bay door was being added, but the Transport Bay containing the door did not reference it nor did the new fixed bay door reference the transport bay. As a result, whenever the file is reloaded, it looks like the bay door is missing. (because it's orphaned).

@codecov
Copy link

codecov bot commented Sep 19, 2021

Codecov Report

Merging #2879 (ffb22b0) into master (6f7f552) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

❗ Current head ffb22b0 differs from pull request most recent head 34f540f. Consider uploading reports for the commit 34f540f to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2879      +/-   ##
============================================
- Coverage     10.62%   10.62%   -0.01%     
+ Complexity     3883     3874       -9     
============================================
  Files           721      721              
  Lines        100581   100582       +1     
  Branches      16425    16425              
============================================
- Hits          10691    10682       -9     
- Misses        88505    88509       +4     
- Partials       1385     1391       +6     
Impacted Files Coverage Δ
MekHQ/src/mekhq/campaign/parts/MissingBayDoor.java 0.00% <0.00%> (ø)
...ekhq/campaign/universe/RandomFactionGenerator.java 56.17% <0.00%> (-2.00%) ⬇️
MekHQ/src/mekhq/campaign/universe/Faction.java 64.74% <0.00%> (-1.29%) ⬇️
...ekHQ/src/mekhq/campaign/market/ContractMarket.java 58.60% <0.00%> (-0.80%) ⬇️
MekHQ/src/mekhq/campaign/universe/Systems.java 42.23% <0.00%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f7f552...34f540f. Read the comment docs.

Copy link
Member

@NickAragua NickAragua 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, one suggestion for variable naming.

MekHQ/src/mekhq/campaign/parts/MissingBayDoor.java Outdated Show resolved Hide resolved
@NickAragua NickAragua merged commit 6529f64 into MegaMek:master Sep 20, 2021
@HoneySkull HoneySkull deleted the HoneySkull_Missing_Bay_Door_#2878 branch September 20, 2021 03:18
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.

0.49.3 - Dropship Mechbay Door (x 1) on one dropship always shows as destroyed when save file is loaded
2 participants