More porting prep, tune up invalidates and touches

This commit is contained in:
Mike Primm 2012-01-09 00:58:37 +08:00 committed by mikeprimm
parent 42418edf1f
commit 3db079f90f
10 changed files with 135 additions and 88 deletions

View file

@ -128,13 +128,13 @@ public class HDMap extends MapType {
public HDLighting getLighting() { return lighting; }
@Override
public MapTile[] getTiles(DynmapLocation loc) {
return perspective.getTiles(loc);
public MapTile[] getTiles(DynmapWorld w, int x, int y, int z) {
return perspective.getTiles(w, x, y, z);
}
@Override
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
return perspective.getTiles(loc, sx, sy, sz);
public MapTile[] getTiles(DynmapWorld w, int minx, int miny, int minz, int maxx, int maxy, int maxz) {
return perspective.getTiles(w, minx, miny, minz, maxx, maxy, maxz);
}
@Override

View file

@ -4,6 +4,7 @@ import java.util.List;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWorld;
import org.dynmap.MapTile;
import org.dynmap.utils.MapChunkCache;
import org.json.simple.JSONObject;
@ -12,9 +13,9 @@ public interface HDPerspective {
/* Get name of perspective */
String getName();
/* Get tiles invalidated by change at given location */
MapTile[] getTiles(DynmapLocation loc);
MapTile[] getTiles(DynmapWorld w, int x, int y, int z);
/* Get tiles invalidated by change at given volume, defined by 2 opposite corner locations */
MapTile[] getTiles(DynmapLocation loc0, int sx, int sy, int sz);
MapTile[] getTiles(DynmapWorld w, int minx, int miny, int minz, int maxx, int maxy, int maxz);
/* Get tiles adjacent to given tile */
MapTile[] getAdjecentTiles(MapTile tile);
/* Get chunks needed for given tile */

View file

@ -816,11 +816,12 @@ public class IsoHDPerspective implements HDPerspective {
}
@Override
public MapTile[] getTiles(DynmapLocation loc) {
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
public MapTile[] getTiles(DynmapWorld world, int x, int y, int z) {
HashSet<MapTile> tiles = new HashSet<MapTile>();
Vector3D block = new Vector3D();
block.setFromLocation(loc); /* Get coordinate for block */
block.x = x;
block.y = y;
block.z = z;
Vector3D corner = new Vector3D();
/* Loop through corners of the cube */
for(int i = 0; i < 2; i++) {
@ -843,16 +844,15 @@ public class IsoHDPerspective implements HDPerspective {
}
@Override
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
public MapTile[] getTiles(DynmapWorld world, int minx, int miny, int minz, int maxx, int maxy, int maxz) {
HashSet<MapTile> tiles = new HashSet<MapTile>();
Vector3D blocks[] = new Vector3D[] { new Vector3D(), new Vector3D() };
blocks[0].x = loc.x - 1;
blocks[0].y = loc.y - 1;
blocks[0].z = loc.z - 1;
blocks[1].x = loc.x + sx;
blocks[1].y = loc.y + sy;
blocks[1].z = loc.z + sz;
blocks[0].x = minx - 1;
blocks[0].y = miny - 1;
blocks[0].z = minz - 1;
blocks[1].x = maxx + 1;
blocks[1].y = maxy + 1;
blocks[1].z = maxz + 1;
Vector3D corner = new Vector3D();
Vector3D tcorner = new Vector3D();