vjurenka / BWMirror-Generator

Generator for BwMirror API
Other
7 stars 7 forks source link

unit.getUnitsInRadius returns new objects #6

Open OpenBW opened 8 years ago

OpenBW commented 8 years ago

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()).