Fix merging sometimes not removing intersection

This commit is contained in:
Jesse Boyd 2016-05-20 03:25:45 +10:00
parent 6bad640cec
commit 5665e9b709

View File

@ -22,7 +22,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.PathIterator; import java.awt.geom.PathIterator;
@ -558,6 +557,7 @@ public class Plot {
case 7: case 7:
int i = direction - 4; int i = direction - 4;
int i2 = 0; int i2 = 0;
System.out.println("CHECK 7 " + this + " | " + this.id.getRelative(i) + " | " + this.id.getRelative(i2) + " | " + i + " | " + i2);
if (this.getSettings().getMerged(i2)) { if (this.getSettings().getMerged(i2)) {
if (this.getSettings().getMerged(i)) { if (this.getSettings().getMerged(i)) {
if (this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)) { if (this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)) {
@ -2643,16 +2643,18 @@ public class Plot {
lesserPlot.setMerged(2, true); lesserPlot.setMerged(2, true);
greaterPlot.setMerged(0, true); greaterPlot.setMerged(0, true);
lesserPlot.mergeData(greaterPlot); lesserPlot.mergeData(greaterPlot);
System.out.println(greaterPlot + " | " + lesserPlot);
if (removeRoads) { if (removeRoads) {
lesserPlot.removeRoadSouth(); lesserPlot.removeRoadSouth();
Plot other = this.getRelative(3); Plot diagonal = greaterPlot.getRelative(1);
if (other.getMerged(2) && other.getMerged(1)) { if (diagonal.getMerged(7)) {
greaterPlot.mergePlot(other, removeRoads); System.out.println(lesserPlot + " SOUTHEAST 1");
other.removeRoadEast();
}
if (lesserPlot.getMerged(5)) {
lesserPlot.removeRoadSouthEast(); lesserPlot.removeRoadSouthEast();
} }
Plot below = greaterPlot.getRelative(3);
if (below.getMerged(4)) {
below.getRelative(0).removeRoadSouthEast();
}
} }
} }
} else { } else {
@ -2667,17 +2669,19 @@ public class Plot {
lesserPlot.setMerged(1, true); lesserPlot.setMerged(1, true);
greaterPlot.setMerged(3, true); greaterPlot.setMerged(3, true);
lesserPlot.mergeData(greaterPlot); lesserPlot.mergeData(greaterPlot);
System.out.println(greaterPlot + " | " + lesserPlot);
if (removeRoads) { if (removeRoads) {
Plot other = lesserPlot.getRelative(0); Plot diagonal = greaterPlot.getRelative(1);
if (other.getMerged(2) && other.getMerged(1)) { if (diagonal.getMerged(7)) {
greaterPlot.mergePlot(other, removeRoads); System.out.println(lesserPlot + " SOUTHEAST 2");
other.removeRoadSouthEast();
}
if (lesserPlot.getMerged(5)) {
lesserPlot.removeRoadSouthEast(); lesserPlot.removeRoadSouthEast();
} }
lesserPlot.removeRoadEast(); lesserPlot.removeRoadEast();
} }
Plot below = greaterPlot.getRelative(0);
if (below.getMerged(6)) {
below.getRelative(3).removeRoadSouthEast();
}
} }
} }
} }