-
Notifications
You must be signed in to change notification settings - Fork 176
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
Unit Values Change after Save and Load for GM Added Units #2873
Comments
Some investigation in the code in Unit.java:1092: [0.49.4 - snapshot as of 9/11/2021] When units are added, and the campaign options indicate value is determined by 'sell value' - the sum of the units parts are added up and then multiplied by 1 + (weight / tonnage) for mechs. The sum of the parts for a unit loaded from a save file are doubled for a unit that is added within the active session. I don't believe this issue is with this code, but something is off on the value of the parts for a unit from being added in-game compared to loaded from a save file. I'm not sure which one is correct. Should the sell value for a Warhammer-6R quality D be 3M or 6M? |
I think I found the issue: When a unit is added through 'Add (GM)' - all the 'parts' for the newly added unit are marked as Non The question is: When should the I believe this is also happening with GM adding parts from the parts in use report. |
Looks like |
When saving the parts list for GM added units, the tag is only saved when the 'brandNew' property is TRUE and leave the tag out if the property is FALSE. Because the default constructor sets the property to TRUE, false values re never saved and loaded.
…oad_state Proposed fix for #2873 - saving the part new flag correctly
Environment
MekHQ 0.49.3
Java vendor Eclipse Foundation
Java version 11.0.12
Platform Windows 10 10.0 (amd64)
Total memory available to MegaMek: 1,048,576 kB
Description
When adding a unit through the 'Add (GM)' or GM Tools RAT generator, the unit value in the finance tab, hangar, and TO&E is approximately half the value of the list price of the mech. Then doing a 'Save' and then 'Load' of the campaign file, the value changes after the load. The value displayed after the load is approximately the unit list price but is off by about 1%. The initial value displayed in the 'Purchase Unit' dialog appears to match the Master Unit List value but is slightly different than what is shown in the Hangar and Finance Tab. The issue in this report is the fact that the value displayed is different after the save and load.
Versions
This issue has been reproduced in:
Files
logs.zip
Test Merc - SaveGlitch30670101.cpnx.gz
The text was updated successfully, but these errors were encountered: