From 5c43225642cf61edcaa1bed79fc128bb2f274646 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 26 Jul 2015 08:12:14 +0100 Subject: [PATCH] create placeholder portals from the field vertices they should already be created from links, but it's handy to select anchors of ghost fields, and there's the odd edge case where the links were too short for some edges of a field --- code/map_data_render.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/code/map_data_render.js b/code/map_data_render.js index fc17f824..57abf462 100644 --- a/code/map_data_render.js +++ b/code/map_data_render.js @@ -357,6 +357,18 @@ window.Render.prototype.createPortalEntity = function(ent) { window.Render.prototype.createFieldEntity = function(ent) { this.seenFieldsGuid[ent[0]] = true; // flag we've seen it + var data = { +// type: ent[2][0], + team: ent[2][1], + points: ent[2][2].map(function(arr) { return {guid: arr[0], latE6: arr[1], lngE6: arr[2] }; }) + }; + + //create placeholder portals for field corners. we already do links, but there are the odd case where this is useful + for (var i=0; i<3; i++) { + var p=data.points[i]; + this.createPlaceholderPortalEntity(p.guid, p.latE6, p.lngE6, data.team); + } + // check if entity already exists if(ent[0] in window.fields) { // yes. in theory, we should never get updated data for an existing field. they're created, and they're destroyed - never changed @@ -371,12 +383,6 @@ window.Render.prototype.createFieldEntity = function(ent) { this.deleteFieldEntity(ent[0]); // option 2, for now } - var data = { -// type: ent[2][0], - team: ent[2][1], - points: ent[2][2].map(function(arr) { return {guid: arr[0], latE6: arr[1], lngE6: arr[2] }; }) - }; - var team = teamStringToId(ent[2][1]); var latlngs = [ L.latLng(data.points[0].latE6/1E6, data.points[0].lngE6/1E6),