diff --git a/code/map_data.js b/code/map_data.js index c78d38de..6d12e7a7 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -165,36 +165,6 @@ window.cleanUp = function() { console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } -// translates guids to entity types -window.getTypeByGuid = function(guid) { - // portals end in “.11” or “.12“, links in “.9", fields in “.b” - // .11 == portals - // .12 == portals - // .9 == links - // .b == fields - // .c == player/creator - // .d == chat messages - switch(guid.slice(33)) { - case '11': - case '12': - return TYPE_PORTAL; - break; - case '9': - return TYPE_LINK; - break; - case 'b': - return TYPE_FIELD; - break; - case 'c': - return TYPE_PLAYER; - break; - case 'd': - return TYPE_CHAT; - break; - default: - return TYPE_UNKNOWN; - } -} // removes given entity from map window.removeByGuid = function(guid) { diff --git a/code/utils_misc.js b/code/utils_misc.js index d74d3bdd..02a202b8 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -138,6 +138,37 @@ window.zoomToAndShowPortal = function(guid, latlng) { map.setView(latlng, 17); } +// translates guids to entity types +window.getTypeByGuid = function(guid) { + // portals end in “.11” or “.12“, links in “.9", fields in “.b” + // .11 == portals + // .12 == portals + // .9 == links + // .b == fields + // .c == player/creator + // .d == chat messages + switch(guid.slice(33)) { + case '11': + case '12': + return TYPE_PORTAL; + + case '9': + return TYPE_LINK; + + case 'b': + return TYPE_FIELD; + + case 'c': + return TYPE_PLAYER; + + case 'd': + return TYPE_CHAT; + + default: + return TYPE_UNKNOWN; + } +} + String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); }