diff --git a/src/main/java/org/dynmap/DynmapWorld.java b/src/main/java/org/dynmap/DynmapWorld.java index 164d6e6b..4deb26fc 100644 --- a/src/main/java/org/dynmap/DynmapWorld.java +++ b/src/main/java/org/dynmap/DynmapWorld.java @@ -106,6 +106,7 @@ public class DynmapWorld { String zoomprefix; String fnprefix; String zfnprefix; + int bigworldshift; } public void freshenZoomOutFilesByLevel(int zoomlevel) { @@ -143,6 +144,7 @@ public class DynmapWorld { for(MapType mt : maps) { List pfx = mt.baseZoomFilePrefixes(); int stepsize = mt.baseZoomFileStepSize(); + int bigworldshift = mt.getBigWorldShift(); boolean neg_step_x = false; if(stepsize < 0) { stepsize = -stepsize; @@ -157,6 +159,7 @@ public class DynmapWorld { pd.baseprefix = p; pd.zoomlevel = zoomlevel; pd.zoomprefix = "zzzzzzzzzzzz".substring(0, zoomlevel); + pd.bigworldshift = bigworldshift; if(bigworld) { if(zoomlevel > 0) { pd.zoomprefix += "_"; @@ -186,7 +189,7 @@ public class DynmapWorld { private String makeFilePath(PrefixData pd, int x, int y, boolean zoomed) { if(bigworld) - return pd.baseprefix + "/" + ((x/pd.stepsize) >> 5) + "_" + ((y/pd.stepsize) >> 5) + "/" + (zoomed?pd.zfnprefix:pd.fnprefix) + x + "_" + y + ".png"; + return pd.baseprefix + "/" + (x >> pd.bigworldshift) + "_" + (y >> pd.bigworldshift) + "/" + (zoomed?pd.zfnprefix:pd.fnprefix) + x + "_" + y + ".png"; else return (zoomed?pd.zfnprefix:pd.fnprefix) + "_" + x + "_" + y + ".png"; } @@ -194,7 +197,6 @@ public class DynmapWorld { private int processZoomDirectory(File dir, PrefixData pd) { Debug.debug("processZoomDirectory(" + dir.getPath() + "," + pd.baseprefix + ")"); HashMap toprocess = new HashMap(); - int step = pd.stepsize << pd.zoomlevel; String[] files = dir.list(new PNGFileFilter(pd.fnprefix)); if(files == null) return 0; @@ -265,6 +267,7 @@ public class DynmapWorld { rec.x = x; rec.y = y; rec.zfname = zfname; + Debug.debug("Process " + zf.getPath() + " due to " + f.getPath()); return rec; } diff --git a/src/main/java/org/dynmap/MapType.java b/src/main/java/org/dynmap/MapType.java index b0e92bbf..0b51c1eb 100644 --- a/src/main/java/org/dynmap/MapType.java +++ b/src/main/java/org/dynmap/MapType.java @@ -30,6 +30,9 @@ public abstract class MapType { public abstract List baseZoomFilePrefixes(); public abstract int baseZoomFileStepSize(); + /* How many bits of coordinate are shifted off to make big world directory name */ + public abstract int getBigWorldShift(); + /** * Step sequence for creating zoomed file: first index is top-left, second top-right, third bottom-left, forth bottom-right * Values correspond to tile X,Y (0), X+step,Y (1), X,Y+step (2), X+step,Y+step (3) diff --git a/src/main/java/org/dynmap/flat/FlatMap.java b/src/main/java/org/dynmap/flat/FlatMap.java index b7be3aac..810f4beb 100644 --- a/src/main/java/org/dynmap/flat/FlatMap.java +++ b/src/main/java/org/dynmap/flat/FlatMap.java @@ -422,6 +422,9 @@ public class FlatMap extends MapType { public int[] zoomFileStepSequence() { return stepseq; } + /* How many bits of coordinate are shifted off to make big world directory name */ + public int getBigWorldShift() { return 5; } + public static class FlatMapTile extends MapTile { FlatMap map; public int x; diff --git a/src/main/java/org/dynmap/kzedmap/KzedMap.java b/src/main/java/org/dynmap/kzedmap/KzedMap.java index 85d2d757..1cd5b6d5 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedMap.java +++ b/src/main/java/org/dynmap/kzedmap/KzedMap.java @@ -341,6 +341,8 @@ public class KzedMap extends MapType { private static final int[] stepseq = { 0, 2, 1, 3 }; public int[] zoomFileStepSequence() { return stepseq; } + /* How many bits of coordinate are shifted off to make big world directory name */ + public int getBigWorldShift() { return 12; } public String getName() { return "KzedMap";