Handle bigmap versus bigworld, allows HDMap to be big-map-style independent of bigworld setting. Add bigmap setting on KzedMap and FlatMap too.

This commit is contained in:
Mike Primm 2011-07-09 15:51:32 -05:00
parent 02fa9384ac
commit 898f4a6740
11 changed files with 51 additions and 24 deletions

View file

@ -16,6 +16,7 @@ import org.dynmap.Client;
import org.dynmap.Color;
import org.dynmap.ColorScheme;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapWorld;
import org.dynmap.MapManager;
import org.dynmap.TileHashManager;
import org.dynmap.debug.Debug;
@ -586,7 +587,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
}
@Override
public void buildClientConfiguration(JSONObject worldObject) {
public void buildClientConfiguration(JSONObject worldObject, DynmapWorld world, KzedMap map) {
ConfigurationNode c = configuration;
JSONObject o = new JSONObject();
s(o, "type", "KzedMapType");
@ -598,6 +599,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
s(o, "nightandday", c.getBoolean("night-and-day", false));
s(o, "backgroundday", c.getString("backgroundday"));
s(o, "backgroundnight", c.getString("backgroundnight"));
s(o, "bigmap", map.isBigWorldMap(world));
a(worldObject, "maps", o);
}
}

View file

@ -47,6 +47,7 @@ public class KzedMap extends MapType {
public static final int anchorz = 0;
MapTileRenderer[] renderers;
private boolean isbigmap;
/* BufferedImage with direct access to its ARGB-formatted data buffer */
public static class KzedBufferedImage {
@ -68,6 +69,7 @@ public class KzedMap extends MapType {
this.renderers = new MapTileRenderer[renderers.size()];
renderers.toArray(this.renderers);
Log.verboseinfo("Loaded " + renderers.size() + " renderers for map '" + getClass().toString() + "'.");
isbigmap = configuration.getBoolean("isbigmap", false);
}
@Override
@ -342,14 +344,20 @@ public class KzedMap extends MapType {
/* How many bits of coordinate are shifted off to make big world directory name */
public int getBigWorldShift() { return 12; }
/* Returns true if big world file structure is in effect for this map */
@Override
public boolean isBigWorldMap(DynmapWorld w) {
return w.bigworld || isbigmap;
}
public String getName() {
return "KzedMap";
}
@Override
public void buildClientConfiguration(JSONObject worldObject) {
public void buildClientConfiguration(JSONObject worldObject, DynmapWorld world) {
for(MapTileRenderer renderer : renderers) {
renderer.buildClientConfiguration(worldObject);
renderer.buildClientConfiguration(worldObject, world, this);
}
}

View file

@ -31,7 +31,7 @@ public class KzedMapTile extends MapTile {
@Override
public String getFilename() {
if(fname == null) {
if(world.bigworld)
if(map.isBigWorldMap(world))
fname = renderer.getName() + "/" + (px >> 12) + '_' + (py >> 12) + '/' + px + "_" + py + ".png";
else
fname = renderer.getName() + "_" + px + "_" + py + ".png";
@ -42,7 +42,7 @@ public class KzedMapTile extends MapTile {
@Override
public String getDayFilename() {
if(fname_day == null) {
if(world.bigworld)
if(map.isBigWorldMap(world))
fname_day = renderer.getName() + "_day/" + (px >> 12) + '_' + (py >> 12) + '/' + px + "_" + py + ".png";
else
fname_day = renderer.getName() + "_day_" + px + "_" + py + ".png";

View file

@ -2,6 +2,7 @@ package org.dynmap.kzedmap;
import java.io.File;
import org.dynmap.DynmapWorld;
import org.dynmap.utils.MapChunkCache;
import org.json.simple.JSONObject;
@ -11,7 +12,7 @@ public interface MapTileRenderer {
boolean render(MapChunkCache cache, KzedMapTile tile, File outputFile);
void buildClientConfiguration(JSONObject worldObject);
void buildClientConfiguration(JSONObject worldObject, DynmapWorld w, KzedMap map);
boolean isBiomeDataNeeded();
boolean isRawBiomeDataNeeded();