From f3c90f0aae4126ab8d0644cfbaebf362de4bcaae Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Sun, 6 Mar 2011 14:45:26 +0100 Subject: [PATCH] Added prefix to flatmap. --- src/main/java/org/dynmap/flat/FlatMap.java | 7 +++++-- web/flatmap.js | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/dynmap/flat/FlatMap.java b/src/main/java/org/dynmap/flat/FlatMap.java index 6ef57d90..a0adc02a 100644 --- a/src/main/java/org/dynmap/flat/FlatMap.java +++ b/src/main/java/org/dynmap/flat/FlatMap.java @@ -18,9 +18,11 @@ import org.dynmap.MapType; import org.dynmap.debug.Debug; public class FlatMap extends MapType { + private String prefix; private ColorScheme colorScheme; public FlatMap(Map configuration) { + prefix = (String)configuration.get("prefix"); colorScheme = ColorScheme.getScheme((String)configuration.get("colorscheme")); } @@ -100,13 +102,14 @@ public class FlatMap extends MapType { } public static class FlatMapTile extends MapTile { - + FlatMap map; public int x; public int y; public int size; public FlatMapTile(World world, FlatMap map, int x, int y, int size) { super(world, map); + this.map = map; this.x = x; this.y = y; this.size = size; @@ -114,7 +117,7 @@ public class FlatMap extends MapType { @Override public String getFilename() { - return "flat_" + size + "_" + x + "_" + y + ".png"; + return map.prefix + "_" + size + "_" + x + "_" + y + ".png"; } } } diff --git a/web/flatmap.js b/web/flatmap.js index 3a976595..1ceaa154 100644 --- a/web/flatmap.js +++ b/web/flatmap.js @@ -11,17 +11,19 @@ FlatProjection.prototype = { } }; -function FlatMapType(configuration) { $.extend(this, configuration); } +function FlatMapType(configuration) { + $.extend(this, configuration); } FlatMapType.prototype = $.extend(new DynMapType(), { constructor: FlatMapType, projection: new FlatProjection(), tileSize: new google.maps.Size(128.0, 128.0), minZoom: 0, maxZoom: 0, + prefix: null, getTile: function(coord, zoom, doc) { var tileName; var tile = $('') - .attr('src', this.dynmap.getTileUrl(tileName = 'flat_128_' + coord.x + '_' + coord.y + '.png')) + .attr('src', this.dynmap.getTileUrl(tileName = this.prefix + '_128_' + coord.x + '_' + coord.y + '.png')) .error(function() { tile.hide(); }) .bind('load', function() { tile.show(); }) .css({