Fix issue with plot border during merge

* `getExtendedTopAbs()` used wrong relative plot for calculating X position.
* Not running `finishPlotMerge()` after every merge led to broken roads during a `merge all`
This commit is contained in:
Alexander Krivács Schrøder 2019-05-29 14:49:27 +02:00 committed by Matt
parent 95cb0d84f0
commit 41299e6851

View File

@ -1669,7 +1669,7 @@ public class Plot {
top.setZ(this.getRelative(Direction.SOUTH).getBottomAbs().getZ() - 1);
}
if (this.getMerged(Direction.EAST)) {
top.setX(this.getRelative(Direction.SOUTH).getBottomAbs().getX() - 1);
top.setX(this.getRelative(Direction.EAST).getBottomAbs().getX() - 1);
}
return top;
}
@ -2243,6 +2243,13 @@ public class Plot {
merged.add(current.getId());
merged.add(other.getId());
toReturn = true;
if (removeRoads) {
ArrayList<PlotId> ids = new ArrayList<>();
ids.add(current.getId());
ids.add(other.getId());
this.getManager().finishPlotMerge(this.area, ids);
}
}
}
if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(Direction.EAST)) {
@ -2255,6 +2262,13 @@ public class Plot {
merged.add(current.getId());
merged.add(other.getId());
toReturn = true;
if (removeRoads) {
ArrayList<PlotId> ids = new ArrayList<>();
ids.add(current.getId());
ids.add(other.getId());
this.getManager().finishPlotMerge(this.area, ids);
}
}
}
if (max >= 0 && (dir == -1 || dir == 2) && !getMerged(Direction.SOUTH)) {
@ -2267,6 +2281,13 @@ public class Plot {
merged.add(current.getId());
merged.add(other.getId());
toReturn = true;
if (removeRoads) {
ArrayList<PlotId> ids = new ArrayList<>();
ids.add(current.getId());
ids.add(other.getId());
this.getManager().finishPlotMerge(this.area, ids);
}
}
}
if (max >= 0 && (dir == -1 || dir == 3) && !getMerged(Direction.WEST)) {
@ -2279,13 +2300,16 @@ public class Plot {
merged.add(current.getId());
merged.add(other.getId());
toReturn = true;
}
}
}
if (removeRoads && toReturn) {
ArrayList<PlotId> ids = new ArrayList<>(merged);
if (removeRoads) {
ArrayList<PlotId> ids = new ArrayList<>();
ids.add(current.getId());
ids.add(other.getId());
this.getManager().finishPlotMerge(this.area, ids);
}
}
}
}
return toReturn;
}