Fixed damaged building memory leak
This commit is contained in:
@@ -143,7 +143,7 @@ public class Units{
|
||||
|
||||
/** Returns the nearest damaged tile. */
|
||||
public static Building findDamagedTile(Team team, float x, float y){
|
||||
return Geometry.findClosest(x, y, indexer.getDamaged(team));
|
||||
return indexer.getDamaged(team).min(b -> b.dst2(x, y));
|
||||
}
|
||||
|
||||
/** Returns the nearest ally tile in a range. */
|
||||
|
||||
@@ -63,6 +63,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
transient boolean enabled = true;
|
||||
transient float enabledControlTime;
|
||||
transient String lastAccessed;
|
||||
transient boolean wasDamaged; //used only by the indexer
|
||||
|
||||
PowerModule power;
|
||||
ItemModule items;
|
||||
@@ -1344,6 +1345,18 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return tile.build == self() && !dead();
|
||||
}
|
||||
|
||||
@MethodPriority(100)
|
||||
@Override
|
||||
public void heal(){
|
||||
indexer.notifyBuildHealed(self());
|
||||
}
|
||||
|
||||
@MethodPriority(100)
|
||||
@Override
|
||||
public void heal(float amount){
|
||||
indexer.notifyBuildHealed(self());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float hitSize(){
|
||||
return tile.block().size * tilesize;
|
||||
|
||||
Reference in New Issue
Block a user