Fix render save/restore when tile scale set

This commit is contained in:
Mike Primm 2022-02-17 09:15:49 -06:00
parent a81249539b
commit 474c5ecca9
2 changed files with 27 additions and 20 deletions

View File

@ -126,7 +126,8 @@ public class HDMapManager {
for(MapType map : w.maps) { for(MapType map : w.maps) {
if(map instanceof HDMap) { if(map instanceof HDMap) {
HDMap hdmap = (HDMap)map; HDMap hdmap = (HDMap)map;
if((hdmap.getPerspective() == tile.perspective) && (hdmap.getBoostZoom() == tile.boostzoom)) { // If same perspective, at same scale (tile and boost), render together
if((hdmap.getPerspective() == tile.perspective) && (hdmap.getBoostZoom() == tile.boostzoom) && (hdmap.getTileScale() == tile.tilescale)) {
/* If limited to one map, and this isn't it, skip */ /* If limited to one map, and this isn't it, skip */
if((mapname != null) && (!hdmap.getName().equals(mapname))) if((mapname != null) && (!hdmap.getName().equals(mapname)))
continue; continue;

View File

@ -23,30 +23,36 @@ public class HDMapTile extends MapTile {
this.tilescale = tilescale; this.tilescale = tilescale;
} }
// public HDMapTile(DynmapWorld world, String parm) throws Exception { // Used for restore of saved pending renders
// super(world); public HDMapTile(DynmapWorld world, String parm) throws Exception {
// super(world);
// String[] parms = parm.split(",");
// if(parms.length < 3) throw new Exception("wrong parameter count"); String[] parms = parm.split(",");
// this.tx = Integer.parseInt(parms[0]); if(parms.length < 3) throw new Exception("wrong parameter count");
// this.ty = Integer.parseInt(parms[1]); this.tx = Integer.parseInt(parms[0]);
// this.perspective = MapManager.mapman.hdmapman.perspectives.get(parms[2]); this.ty = Integer.parseInt(parms[1]);
// if(this.perspective == null) throw new Exception("invalid perspective"); this.perspective = MapManager.mapman.hdmapman.perspectives.get(parms[2]);
// if(parms.length > 3) if(this.perspective == null) throw new Exception("invalid perspective");
// this.boostzoom = Integer.parseInt(parms[3]); if(parms.length > 3)
// else this.boostzoom = Integer.parseInt(parms[3]);
// this.boostzoom = 0; else
// this.tilescale = 0; this.boostzoom = 0;
// } if (parms.length > 4) {
this.tilescale = Integer.parseInt(parms[4]);
}
else {
this.tilescale = 0;
}
}
@Override @Override
protected String saveTileData() { protected String saveTileData() {
return String.format("%d,%d,%s,%d", tx, ty, perspective.getName(), boostzoom); return String.format("%d,%d,%s,%d,%d", tx, ty, perspective.getName(), boostzoom, tilescale);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return tx ^ ty ^ perspective.hashCode() ^ world.hashCode() ^ boostzoom; return tx ^ ty ^ perspective.hashCode() ^ world.hashCode() ^ boostzoom ^ tilescale;
} }
@Override @Override
@ -58,12 +64,12 @@ public class HDMapTile extends MapTile {
} }
public boolean equals(HDMapTile o) { public boolean equals(HDMapTile o) {
return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.world == world) && (o.boostzoom == boostzoom); return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.world == world) && (o.boostzoom == boostzoom) && (o.tilescale == tilescale);
} }
@Override @Override
public String toString() { public String toString() {
return world.getName() + ":" + perspective.getName() + "," + tx + "," + ty + ":" + boostzoom; return world.getName() + ":" + perspective.getName() + "," + tx + "," + ty + ":" + boostzoom + ":" + tilescale;
} }
@Override @Override