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

Handled StratCon Scenario Placement Failure when All Coordinates Occupied #5141

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

IllianiCBT
Copy link
Collaborator

Added checks to handle scenarios where facilities or objectives could not be placed because all coordinates in a StratCon track were occupied. Issued warnings and errors, and updated the getUnoccupiedCoords method to return null when placement is not possible.

It's worth noting that this is not a scenario that is likely to ever come up, because what are the chances we try to place a new scenario down on a track where every hex is occupied? In vanilla StratCon that scenario will never occur because getUnoccupiedCoords is only called at the beginning of a contract when a track is effectively empty.

I'm currently working on a secret project that will require me to place events on the StratCon map. I'm planning to use getUnoccupiedCoords, as I don't want stacked events, but that raises the chance of this exception occurring from 'none' to 'very low'. Prior to this PR, if that scenario did occur the client would end in an infinite loop.

…pied

Added checks to handle scenarios where facilities or objectives could not be placed because all coordinates were occupied. Issued warnings and errors, and updated the `getUnoccupiedCoords` method to return null when placement is not possible.
@IllianiCBT IllianiCBT added StratCon Bugs relating strictly to StratCon Refactoring labels Oct 28, 2024
@IllianiCBT IllianiCBT self-assigned this Oct 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.53%. Comparing base (fb6c52a) to head (c4b5af8).
Report is 32 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5141      +/-   ##
============================================
- Coverage     10.53%   10.53%   -0.01%     
- Complexity     6041     6043       +2     
============================================
  Files           956      956              
  Lines        134253   134276      +23     
  Branches      19501    19508       +7     
============================================
+ Hits          14142    14144       +2     
- Misses       118760   118780      +20     
- Partials       1351     1352       +1     

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

@HammerGS HammerGS merged commit 6ce4edc 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
Refactoring StratCon Bugs relating strictly to StratCon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants