if a unit a is in range of an enemy unit e, calling e.getUnitsInRadius(range) will return a different unit object b, such that a.equals(b) == false even though a.getID() == b.getID().
AFAIK this can be reproduced anytime.
Proposal: either maintain only one unit object per unit or override the equals method of the Unit class such that it returns true for objects with the same ID (unit1.getID() == unit2.getID()).
if a unit
a
is in range of an enemy unite
, callinge.getUnitsInRadius(range)
will return a different unit objectb
, such thata.equals(b) == false
even thougha.getID() == b.getID()
.AFAIK this can be reproduced anytime.
Proposal: either maintain only one unit object per unit or override the equals method of the Unit class such that it returns true for objects with the same ID (
unit1.getID() == unit2.getID()
).