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

Added New StratCon Scenario Generation Utility Method #5142

Merged
merged 5 commits into from
Oct 29, 2024

Conversation

IllianiCBT
Copy link
Collaborator

Added a new helper method to StratconRulesManager that allows Classes outside of StratCon to spawn StratCon scenarios. These scenarios can be spawned either on a random or specific Track. Likewise, the scenario template can be either specific or random.

I also extracted some repeated logic into helper methods and consolidated map location imports, seeing that they're being used in a whole bunch of places in this class.

Finally, I adjusted generateScenariosForTrack (which my new method is based on) to only place scenarios in unoccupied locations. This should help avoid scenarios being lost under facilities (or visa versa) and is meant to work alongside the changes made in #5141.

Extracted repeated logic into helper methods and consolidated map location imports. Enhanced clarity and maintainability by introducing generateExternalScenario and finalizeBackingScenario methods.
Extracted repeated logic into helper methods and consolidated map location imports. Enhanced clarity and maintainability by introducing generateExternalScenario and finalizeBackingScenario methods.
Replaced tracks.size() > 0 with tracks.isEmpty() to improve readability. Added a return statement to abort scenario generation if no tracks are available, preventing potential errors.
@IllianiCBT IllianiCBT added StratCon Bugs relating strictly to StratCon Utility A new utility function or developer tool labels Oct 28, 2024
@IllianiCBT IllianiCBT self-assigned this Oct 28, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.53%. Comparing base (fb6c52a) to head (8392a38).
Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5142   +/-   ##
=========================================
  Coverage     10.53%   10.53%           
  Complexity     6041     6041           
=========================================
  Files           956      956           
  Lines        134253   134305   +52     
  Branches      19501    19513   +12     
=========================================
+ Hits          14142    14148    +6     
- Misses       118760   118806   +46     
  Partials       1351     1351           

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

@HammerGS
Copy link
Member

This has picked up conflicts

# Conflicts:
#	MekHQ/src/mekhq/campaign/stratcon/StratconContractInitializer.java
Integrated the MekSearchFilter import to support advanced unit searching capabilities. This update is part of an enhancement for improved search functionality within the MekHQ unit selection dialog.
@HammerGS HammerGS merged commit 77ebc06 into MegaMek:master Oct 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
StratCon Bugs relating strictly to StratCon Utility A new utility function or developer tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants