8000 Fix for Unit Sale Costs being generally incorrect - Mekhq part by savanik · Pull Request #6868 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix for Unit Sale Costs being generally incorrect - Mekhq part #6868

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

Merged
merged 2 commits into from
May 6, 2025

Conversation

savanik
Copy link
Contributor
@savanik savanik commented May 4, 2025

Updated functions in TankLocation.java to correct sale price. Location costs now calculate for internal structure / controls. Still needs updates for chassis costs per support vehicles in Tech Manual p280, maybe?

Copy link
codecov bot commented May 4, 2025

Codecov Report

Attention: Patch coverage is 35.00000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 11.51%. Comparing base (c73a91d) to head (84192eb).
Report is 326 commits behind head on master.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/campaign/parts/TankLocation.java 35.00% 10 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6868      +/-   ##
============================================
+ Coverage     11.41%   11.51%   +0.10%     
- Complexity     6479     6564      +85     
============================================
  Files          1095     1100       +5     
  Lines        140820   140977     +157     
  Branches      21813    21845      +32     
============================================
+ Hits          16069    16238     +169     
+ Misses       123089   123046      -43     
- Partials       1662     1693      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@savanik savanik force-pushed the VehicleCostFixes branch from 1e4a95e to 84192eb Compare May 4, 2025 17:10
@savanik
Copy link
Contributor Author
savanik commented May 4, 2025

Updated the commit comments to properly reflect what was being updated. No other changes.

@HammerGS HammerGS requested a review from Copilot May 6, 2025 02:46
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the calculation issues related to unit sale costs in TankLocation by updating functions to compute internal location costs more accurately.

  • Reformatted the TechAdvancement chain for better readability.
  • Updated the isSamePartType and details methods with cleaner formatting.
  • Implemented new logic in getTonnage and getStickerPrice to reflect internal structure and controls costs.

Comment on lines +310 to +311
structureCost += 10000 * getTonnage(); // True for SVs as well?
controlsCost += 10000 * getTonnage() / 2;
Copy link
Preview
Copilot AI May 6, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider caching the result of getTonnage() into a local variable if its computation becomes non-trivial to avoid redundant calls and improve maintainability.

Suggested change
structureCost += 10000 * getTonnage(); // True for SVs as well?
controlsCost += 10000 * getTonnage() / 2;
double tonnage = getTonnage();
structureCost += 10000 * tonnage; // True for SVs as well?
controlsCost += 10000 * tonnage / 2;

Copilot uses AI. Check for mistakes.

// Cannot have endo steel etc.
// Turrets are handled separately
double tonnage = getUnitTonnage() * 0.1 / 4;
return (tonnage);
Copy link
Preview
Copilot AI May 6, 2025

Choose a reason for hiding this comment

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

[nitpick] The parentheses around the 'tonnage' variable in the return statement are unnecessary. Consider simplifying the code to 'return tonnage;'.

Suggested change
return (tonnage);
return tonnage;

Copilot uses AI. Check for mistakes.

@Scoppio Scoppio m 8352 erged commit 33a30cf into MegaMek:master May 6, 2025
6 checks passed
@savanik savanik deleted the VehicleCostFixes branch May 20, 2025 16:05
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
0