Closed trevan closed 4 years ago
This is a good spot. :eagle:
The manual computation of hashcode likely should be replaced with either a hashcode builder or lombok EqualsAndHashCode
I've gone through git history and the code to calculate the key was better. But during a refactoring in 57f11454522a762d2ff273ed445d29b0ee17725e (back in 2015), the key calculation was converted into the sum and has been that way since.
How can the problem be recreated?
Play the save game.
In
CasualtyOrderOfLosses#sortUnitsForCasualtiesWithSupport
, a key is generated to look up inCasualtyOrderOfLosses#oolCache
. This key is generated by summing up all of the hash codes of the types in the targets.In Warcraft War Heroes, there are some combination of types that have the same hashcode as other combinations of types.
An example is:
And
Do you have any ideas for an expected fix?
The hashcode of unittype either needs to be changed to not just be the name or the key needs to be more than a sum.
Attach a Save Game
wow-u25.zip
If playing a prerelease, which version are you using?
Game Version: Master
If playing a prerelease, does this happen on the latest release?
Is there anything else we should know?
This causes an exception
java.lang.IllegalStateException: sortedTargetsToPickFrom must have the same size as targetsToPickFrom list
so it is visible.