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

Markets Tab and AbstractUnitMarket #2478

Merged

Conversation

Windchild292
Copy link
Contributor

@Windchild292 Windchild292 commented Mar 18, 2021

This PR creates the Markets Tab (following the setup from #2417), abstracts out the Unit Market, makes the Unit Market accessible outside of AtB, redoes the Unit Market Dialog to improve base functionality and simplify the backend, and adds the EntityViewPane and EntityImagePanel components (MegaMek/megamek#2783 merged these into MegaMek).

For reviewers:
Unit Market Dialog was completely rewritten, with it being replaced with a minimal dialog over the primary pane. The previous setup can be ignored.

I previously had this being implemented alongside the AbstractContractMarket, and have carried over the resources and options from there, plus some of the implementation albeit in a commented out state (with TODO statements written for the changes so they are easily searchable). Doing the latter was proving to be too much to do at once, hence the division.

@Windchild292 Windchild292 added (RFE) Enhancement Requests for Enhancement, new features or implementations GUI labels Mar 18, 2021
@Windchild292 Windchild292 self-assigned this Mar 18, 2021
@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #2478 (48915da) into master (0002bc9) will decrease coverage by 0.11%.
The diff coverage is n/a.

❗ Current head 48915da differs from pull request most recent head 497f134. Consider uploading reports for the commit 497f134 to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2478      +/-   ##
============================================
- Coverage     10.73%   10.62%   -0.12%     
- Complexity     3805     3868      +63     
============================================
  Files           700      721      +21     
  Lines         97891    99960    +2069     
  Branches      16307    16405      +98     
============================================
+ Hits          10512    10621     +109     
- Misses        86001    87954    +1953     
- Partials       1378     1385       +7     
Impacted Files Coverage Δ
.../mekhq/campaign/market/enums/UnitMarketMethod.java 57.14% <0.00%> (-28.58%) ⬇️
...hq/campaign/market/enums/ContractMarketMethod.java 72.72% <0.00%> (-12.99%) ⬇️
MekHQ/src/mekhq/gui/enums/LayeredForceIcon.java 45.00% <0.00%> (-11.67%) ⬇️
MekHQ/src/mekhq/campaign/universe/Factions.java 51.51% <0.00%> (-5.12%) ⬇️
...ekhq/campaign/universe/RandomFactionGenerator.java 56.57% <0.00%> (-2.23%) ⬇️
MekHQ/src/mekhq/MekHQOptions.java 1.78% <0.00%> (-2.22%) ⬇️
MekHQ/src/mekhq/MekHqXmlUtil.java 15.23% <0.00%> (-1.18%) ⬇️
MekHQ/src/mekhq/campaign/universe/Systems.java 41.43% <0.00%> (-0.80%) ⬇️
MekHQ/src/mekhq/campaign/mission/Mission.java 17.94% <0.00%> (-0.48%) ⬇️
MekHQ/src/mekhq/campaign/parts/Part.java 35.07% <0.00%> (-0.18%) ⬇️
... and 145 more

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 f6e661d...497f134. Read the comment docs.

Copy link
Contributor

@sixlettervariables sixlettervariables left a comment

Choose a reason for hiding this comment

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

Some comments after my first pass.

@Windchild292 Windchild292 mentioned this pull request Apr 21, 2021
12 tasks
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.

One usability/convenience suggestion, and one other thing that I already forgot what it was. Ah, there it is, philosophical question.

campaign));
int weightClass;
do {
weightClass = AtBMonthlyUnitMarket.getRandomWeight(campaign, UnitType.MEK, contract.getEmployerFaction());
Copy link
Member

Choose a reason for hiding this comment

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

How about just introducing a getRandomWeight() method in there with an upper limit instead to cut down on random loops?

Copy link
Contributor Author

@Windchild292 Windchild292 Jun 11, 2021

Choose a reason for hiding this comment

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

It would require two methods (minimum limit, maximum limit) for something used three times (twice here [1 min, 1 max], once in PirateFreeForAllBuiltInScenario). I don't think the underlying code increase to handle min/max weights would be worth it, hence why I did it as do-while loops.

case COL_PRICE:
case COL_PERCENT:
case COL_DELIVERY:
Copy link
Member

Choose a reason for hiding this comment

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

Kind of a moot point, I suppose, but do we really want the player to know ahead of time how long it'll take to get a particular unit delivered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is like shipping, so... it makes sense to me.

@Windchild292
Copy link
Contributor Author

Is there anything else for this? I'd like to start working on phase 2 in the nearish future @NickAragua

@NickAragua
Copy link
Member

NickAragua commented Jul 27, 2021

I'm going to call this one good to go, since I'm not too concerned about performance in a couple rare legacy AtB scenarios.

@Windchild292 Windchild292 merged commit d86c1c8 into MegaMek:master Jul 27, 2021
@Windchild292 Windchild292 deleted the dev_Windchild_AbstractUnitMarket branch July 27, 2021 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI (RFE) Enhancement Requests for Enhancement, new features or implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants