Another bigworld+isomaps+zoom-out fix - directory name inconsistency

This commit is contained in:
Mike Primm 2011-06-24 14:18:21 -05:00
parent 5bb3249dfe
commit f3ac3d9be4
4 changed files with 13 additions and 2 deletions

View File

@ -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<String> 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<String, ProcessTileRec> toprocess = new HashMap<String, ProcessTileRec>();
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;
}

View File

@ -30,6 +30,9 @@ public abstract class MapType {
public abstract List<String> 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)

View File

@ -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;

View File

@ -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";