forked from External/mage
Removed majority of memory leaks from game / editor / dialog handling.
This commit is contained in:
parent
11df1dc059
commit
0a18a7bea6
24 changed files with 215 additions and 138 deletions
|
|
@ -102,6 +102,11 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
this.bigCard = bigCard;
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
permanents.clear();
|
||||
Plugins.getInstance().sortPermanents(ui, permanents.values());
|
||||
}
|
||||
|
||||
public void update(Map<UUID, PermanentView> battlefield) {
|
||||
boolean changed = false;
|
||||
|
||||
|
|
@ -281,28 +286,28 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
}
|
||||
}
|
||||
|
||||
private Rectangle findEmptySpace(Dimension size) {
|
||||
int battlefieldWidth = this.getWidth();
|
||||
Rectangle r = new Rectangle(size);
|
||||
boolean intersects;
|
||||
while (true) {
|
||||
intersects = false;
|
||||
for (MagePermanent perm: permanents.values()) {
|
||||
Rectangle pr = perm.getBounds();
|
||||
if (r.intersects(pr)) {
|
||||
intersects = true;
|
||||
if (pr.x + pr.width + r.width > battlefieldWidth)
|
||||
r.setLocation(0, pr.y + pr.height + 1);
|
||||
else
|
||||
r.translate(pr.x + pr.width - r.x, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!intersects)
|
||||
break;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
// private Rectangle findEmptySpace(Dimension size) {
|
||||
// int battlefieldWidth = this.getWidth();
|
||||
// Rectangle r = new Rectangle(size);
|
||||
// boolean intersects;
|
||||
// while (true) {
|
||||
// intersects = false;
|
||||
// for (MagePermanent perm: permanents.values()) {
|
||||
// Rectangle pr = perm.getBounds();
|
||||
// if (r.intersects(pr)) {
|
||||
// intersects = true;
|
||||
// if (pr.x + pr.width + r.width > battlefieldWidth)
|
||||
// r.setLocation(0, pr.y + pr.height + 1);
|
||||
// else
|
||||
// r.translate(pr.x + pr.width - r.x, 0);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (!intersects)
|
||||
// break;
|
||||
// }
|
||||
// return r;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isOptimizedDrawingEnabled () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue