Handled StratCon Scenario Placement Failure when All Coordinates Occupied #5141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.