triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.3k stars 387 forks source link

Small clean up to sortUnitsForCasualtiesWithSupport(). #12698

Closed asvitkine closed 2 weeks ago

asvitkine commented 2 weeks ago

Since we'll need to debug this code for https://github.com/triplea-game/triplea/issues/12689, this is a prelim cleanup to make the code easier to understand.

It splits out the core logic into an impl function, with the caching logic being a wrapper around it. Also improves some comments and uses some local variables to reduce wrapping.

No functional changes.

Notes to Reviewer