Fix augmented for road size = 0

This commit is contained in:
boy0001 2015-04-05 02:20:26 +10:00
parent d01b506443
commit 9195c2271c
3 changed files with 34 additions and 17 deletions

View File

@ -98,12 +98,18 @@ public class HybridGen extends PlotGenerator {
this.wallheight = this.plotworld.WALL_HEIGHT; this.wallheight = this.plotworld.WALL_HEIGHT;
this.roadheight = this.plotworld.ROAD_HEIGHT; this.roadheight = this.plotworld.ROAD_HEIGHT;
this.plotheight = this.plotworld.PLOT_HEIGHT; this.plotheight = this.plotworld.PLOT_HEIGHT;
if (this.pathsize == 0) {
this.pathWidthLower = (short) -1;
this.pathWidthUpper = (short) (this.plotsize + 1);
}
else {
if ((this.pathsize % 2) == 0) { if ((this.pathsize % 2) == 0) {
this.pathWidthLower = (short) (Math.floor(this.pathsize / 2) - 1); this.pathWidthLower = (short) (Math.floor(this.pathsize / 2) - 1);
} else { } else {
this.pathWidthLower = (short) (Math.floor(this.pathsize / 2)); this.pathWidthLower = (short) (Math.floor(this.pathsize / 2));
} }
this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1); this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1);
}
this.biome = Biome.valueOf(this.plotworld.PLOT_BIOME); this.biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
try { try {
this.maxY = Bukkit.getWorld(plotworld.worldname).getMaxHeight(); this.maxY = Bukkit.getWorld(plotworld.worldname).getMaxHeight();
@ -224,7 +230,7 @@ public class HybridGen extends PlotGenerator {
} }
} }
} }
} else { } else if (pathsize != 0) {
// wall // wall
if (((absX >= this.pathWidthLower) && (absX <= this.pathWidthUpper) && (absZ >= this.pathWidthLower) && (absZ <= this.pathWidthUpper))) { if (((absX >= this.pathWidthLower) && (absX <= this.pathWidthUpper) && (absZ >= this.pathWidthLower) && (absZ <= this.pathWidthUpper))) {
for (short y = 1; y <= this.wallheight; y++) { for (short y = 1; y <= this.wallheight; y++) {

View File

@ -78,6 +78,11 @@ public class HybridPop extends PlotPopulator {
this.wallheight = this.plotworld.WALL_HEIGHT; this.wallheight = this.plotworld.WALL_HEIGHT;
this.roadheight = this.plotworld.ROAD_HEIGHT; this.roadheight = this.plotworld.ROAD_HEIGHT;
this.plotheight = this.plotworld.PLOT_HEIGHT; this.plotheight = this.plotworld.PLOT_HEIGHT;
if (this.pathsize == 0) {
this.pathWidthLower = (short) -1;
this.pathWidthUpper = (short) (this.plotsize + 1);
}
else {
if ((this.pathsize % 2) == 0) { if ((this.pathsize % 2) == 0) {
this.pathWidthLower = (short) (Math.floor(this.pathsize / 2) - 1); this.pathWidthLower = (short) (Math.floor(this.pathsize / 2) - 1);
} else { } else {
@ -85,6 +90,7 @@ public class HybridPop extends PlotPopulator {
} }
this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1); this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1);
} }
}
public final long nextLong() { public final long nextLong() {
final long a = this.state; final long a = this.state;
@ -192,7 +198,7 @@ public class HybridPop extends PlotPopulator {
} }
} }
} }
} else { } else if (pathsize != 0) {
// wall // wall
if (((absX >= this.pathWidthLower) && (absX <= this.pathWidthUpper) && (absZ >= this.pathWidthLower) && (absZ <= this.pathWidthUpper))) { if (((absX >= this.pathWidthLower) && (absX <= this.pathWidthUpper) && (absZ >= this.pathWidthLower) && (absZ <= this.pathWidthUpper))) {
for (short y = 1; y <= this.wallheight; y++) { for (short y = 1; y <= this.wallheight; y++) {

View File

@ -35,11 +35,16 @@ public abstract class SquarePlotManager extends GridPlotManager {
public PlotId getPlotIdAbs(final PlotWorld plotworld, int x, final int y, int z) { public PlotId getPlotIdAbs(final PlotWorld plotworld, int x, final int y, int z) {
final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld); final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld);
int pathWidthLower; int pathWidthLower;
if (dpw.ROAD_WIDTH == 0) {
pathWidthLower = -1;
}
else {
if ((dpw.ROAD_WIDTH % 2) == 0) { if ((dpw.ROAD_WIDTH % 2) == 0) {
pathWidthLower = (dpw.ROAD_WIDTH / 2) - 1; pathWidthLower = (dpw.ROAD_WIDTH / 2) - 1;
} else { } else {
pathWidthLower = dpw.ROAD_WIDTH / 2; pathWidthLower = dpw.ROAD_WIDTH / 2;
} }
}
final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH; final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH;
int idx; int idx;
int idz; int idz;