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

Camops Paid Recrutiment Removal #5007

Merged
merged 5 commits into from
Oct 11, 2024

Conversation

WeaverThree
Copy link
Collaborator

This fixes the real issue behind #4986: that paid recruitment is even available when camops markets are selected.

It adds camops markets as a reason not to show the paid recruitment controls. It also makes sure paid recruitment is turned if the controls are turned off, though this won't come into effect until the window is opened.

Added bonus QoL: Since camops markets only have one person at a time, select the first person in the list automatically when opened. One less click and it doesn't really hurt other market types either.

@IllianiCBT
Copy link
Collaborator

@Algebro7 do you have review permissions? If so, I'll leave this for you to review as it's your stomping ground. If not, when you're available can you take a look and just reply whether you approve the changes or not.

@codecov-commenter
Copy link

codecov-commenter commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.45%. Comparing base (4e72790) to head (8ff8b70).
Report is 34 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5007      +/-   ##
============================================
- Coverage     10.47%   10.45%   -0.03%     
+ Complexity     6029     6014      -15     
============================================
  Files           950      950              
  Lines        133397   133408      +11     
  Branches      19384    19386       +2     
============================================
- Hits          13974    13948      -26     
- Misses       118076   118111      +35     
- Partials       1347     1349       +2     

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

@Algebro7
Copy link
Collaborator

Algebro7 commented Oct 8, 2024

Not sure but I'll take a look ASAP!

Copy link
Collaborator

@Algebro7 Algebro7 left a comment

Choose a reason for hiding this comment

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

Looks great, thanks a lot for the contribution! I've requested a couple of changes that I think we need to make before merging this. Let me know if you have any questions.

MekHQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java Outdated Show resolved Hide resolved
@@ -229,6 +232,10 @@ public Component getListCellRendererComponent(JList<?> list, Object value, int i
} else {
radioNormalRoll.setSelected(true);
}
} else {
// Turn off paid recruitment if it's not available
Copy link
Collaborator

@Algebro7 Algebro7 Oct 9, 2024

Choose a reason for hiding this comment

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

I think you mentioned this in the PR discussion, but right now when the user switches the market to CamOps in Campaign Options while having paid recruitment rolls enabled and advances days, paid recruitment rolls still happen until you open the market dialog. I think this will lead to a confusing user experience, so we probably need to update the campaign options to disable paid recruitment rolls whenever the options are saved with Camops selected.

I know I said to try and avoid messing with Campaign Options since they're being refactored by @IllianiCBT , but IMO we need to address this as part of this PR. You'd want to look around in https://github.com/MegaMek/mekhq/blob/master/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java#L9480 for this, which is executed when the campaign options are saved.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Make the necessary changes, I'll deal with the conflicts :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I've added something to diable paid recruitment when the campaign options are processed, but that doesn't handle the case of someone loading a game with paid recruitment active. Though with #5006 I'm not entirely sure that PersonnelMarket.java is loading paid recruitment FROM the save file?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I should have read this message before putting in my review :D

Copy link
Collaborator

@IllianiCBT IllianiCBT left a comment

Choose a reason for hiding this comment

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

But wait, there's more :p

There was not more

@IllianiCBT
Copy link
Collaborator

I've approved this PR, so it should be good to merge.

I am a little concerned that we're not sanitizing saves as users load into the client. However, so long as #5006 is causing saves to load in with paid recruitment disabled, I'm not too bothered.

@HammerGS HammerGS merged commit 71b0674 into MegaMek:master Oct 11, 2024
4 checks passed
@WeaverThree WeaverThree deleted the wvr-4986-camops-pmarket-fix branch October 16, 2024 17:25
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.

5 participants