Add alternate directory structure to better support huge worlds

This commit is contained in:
Mike Primm 2011-06-13 21:43:02 -05:00
parent b19d8f8745
commit 0cf7b4be9b
16 changed files with 118 additions and 51 deletions

View file

@ -28,8 +28,12 @@ FlatMapType.prototype = $.extend(new DynMapType(), {
var dnprefix = '';
if(this.dynmap.map.mapTypes[this.dynmap.map.mapTypeId].nightandday && this.dynmap.serverday)
dnprefix = '_day';
tileName = this.prefix + dnprefix + '_128_' + coord.x + '_' + coord.y + '.png';
if(this.dynmap.world.bigworld)
tileName = this.prefix + dnprefix + '/' + (coord.x >> 5) + '_' + (coord.y >> 5) +
'/128_' + coord.x + '_' + coord.y + '.png';
else
tileName = this.prefix + dnprefix + '_128_' + coord.x + '_' + coord.y + '.png';
imgSize = Math.pow(2, 7+zoom);
var tile = $('<div/>')
.addClass('tile')

View file

@ -50,14 +50,28 @@ KzedMapType.prototype = $.extend(new DynMapType(), {
if (zoom == 0) {
// Most zoomed out tiles.
tileSize = 128;
imgSize = tileSize;
tileName = 'z' + this.prefix + dnprefix + '_' + (-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
imgSize = tileSize;
if (this.dynmap.world.bigworld) {
tileName = 'z' + this.prefix + dnprefix + '/' + ((-coord.x * tileSize*2)>>12) +
'_' + ((coord.y * tileSize*2) >> 12) + '/' +
(-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
}
else {
tileName = 'z' + this.prefix + dnprefix + '_' + (-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
}
} else {
// Other zoom levels.
tileSize = 128;
imgSize = Math.pow(2, 6+zoom);
tileName = this.prefix + dnprefix + '_' + (-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
if(this.dynmap.world.bigworld) {
tileName = this.prefix + dnprefix + '/' + ((-coord.x*tileSize) >> 12) + '_' +
((coord.y*tileSize)>>12) + '/' +
(-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
}
else {
tileName = this.prefix + dnprefix + '_' + (-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
}
}
var img;
var tile = $('<div/>')