Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix OccupiedCells for units sharing cells #17292
Disclaimer: The OccuipedCells and crushing logic is wonky as a donkey in the previous release.
If you log the OccuipedCells during a move you can observe why this is the case (hint: look for when the unit exist in the
Unit thats share cells have this pattern when moving to a new cell with at least 2 empty subcells
Compare to when there is only 1 free subcell.
Its probably ok to draw the conclusion that subcell units that trying to dodge a crush by moving to a cell with only 1 free sub cell will fail more often.
Also if the unit need to turn before the move it will fail (depending on how long the turn takes.)
This fix here will hopefully be good enough for fixing the dodging for Infantry.
This leaves me a bit uncomfortable because it is still an obvious hack. There is no reason to tie this to
While this may work for now, it is based on assumptions that can break at any moment, so at the least we should add a comment here that this is a hack and we should try to rethink the way mobile units occupy cells for next +1.
Yeah thats the idea, for a proper fix on the whole issue with crushing.
pchote left a comment
Confirmed the wonky pre-#17159 behaviour, and that this should recreate the previous behaviour except for:
These edge cases are probably fine to leave out, I can't think of any cases that would rely on them.