fixed bug when deleting tiles
This commit is contained in:
@@ -104,7 +104,7 @@ public abstract class Bridge extends Tile {
|
||||
@Override
|
||||
public void removeChild(BaseClass child) {
|
||||
if (child == counterpart) counterpart = null;
|
||||
plan.place(this);
|
||||
super.removeChild(child);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -190,6 +190,7 @@ public class Contact extends Tile{
|
||||
@Override
|
||||
public void removeChild(BaseClass child) {
|
||||
if (child == actions) actions = null;
|
||||
super.removeChild(child);
|
||||
}
|
||||
|
||||
public static Select selector(Contact preselect) {
|
||||
|
||||
@@ -33,10 +33,11 @@ public class Shadow extends Tile{
|
||||
|
||||
@Override
|
||||
public void removeChild(BaseClass child) {
|
||||
super.removeChild(child);
|
||||
if (child == overlay) {
|
||||
overlay = null;
|
||||
remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,9 +77,9 @@ public abstract class StretchableTile extends Tile {
|
||||
|
||||
@Override
|
||||
public BaseClass remove() {
|
||||
super.remove();
|
||||
LOG.debug("Removing stretchable Tile ({}) {}",id(),this);
|
||||
removeShadows();
|
||||
return this;
|
||||
return super.remove();
|
||||
}
|
||||
|
||||
private void removeShadows() {
|
||||
|
||||
@@ -376,16 +376,24 @@ public abstract class Tile extends BaseClass implements Comparable<Tile>{
|
||||
|
||||
@Override
|
||||
public BaseClass remove() {
|
||||
super.remove();
|
||||
while (!routes.isEmpty()) routes.first().remove();
|
||||
return this;
|
||||
while (!routes.isEmpty()) {
|
||||
routes.first().remove();
|
||||
}
|
||||
return super.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChild(BaseClass child) {
|
||||
routes.remove(child);
|
||||
String childAsString = child.toString();
|
||||
if (childAsString.length()>20) childAsString = childAsString.substring(0, 20)+"…";
|
||||
LOG.debug("Removing {} from {}",childAsString,this);
|
||||
if (child instanceof Route) {
|
||||
routes.remove(child);
|
||||
}
|
||||
|
||||
if (child == train) train = null;
|
||||
if (child == route) route = null;
|
||||
super.removeChild(child);
|
||||
plan.place(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user