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) {
if(map instanceof HDMap) {
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((mapname != null) && (!hdmap.getName().equals(mapname)))
continue;

View File

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