initial implementation of ornaments

This commit is contained in:
fkloft
2014-09-25 20:53:05 +02:00
parent c44f4793cf
commit a64f76c862
3 changed files with 67 additions and 3 deletions

View File

@ -44,7 +44,7 @@ window.Render.prototype.clearPortalsBelowLevel = function(level) {
for (var guid in window.portals) {
var p = portals[guid];
// clear portals below specified level - unless it's the selected portal, or it's relevant to artifacts
if (parseInt(p.options.level) < level && guid !== selectedPortal && !artifact.isInterestingPortal(guid)) {
if (parseInt(p.options.level) < level && guid !== selectedPortal && !artifact.isInterestingPortal(guid) && !ornaments.isInterestingPortal(p)) {
this.deletePortalEntity(guid);
count++;
}
@ -433,7 +433,7 @@ window.Render.prototype.resetPortalClusters = function() {
var guid = c[i];
var p = window.portals[guid];
var layerGroup = portalsFactionLayers[parseInt(p.options.level)][p.options.team];
if ((i<this.CLUSTER_PORTAL_LIMIT || p.options.guid == selectedPortal || artifact.isInterestingPortal(p.options.guid)) && this.bounds.contains(p.getLatLng())) {
if ((i<this.CLUSTER_PORTAL_LIMIT || p.options.guid == selectedPortal || artifact.isInterestingPortal(p.options.guid) || ornaments.isInterestingPortal(p)) && this.bounds.contains(p.getLatLng())) {
if (!layerGroup.hasLayer(p)) {
layerGroup.addLayer(p);
}
@ -456,10 +456,15 @@ window.Render.prototype.addPortalToMapLayer = function(portal) {
this.portalClusters[cid].push(portal.options.guid);
window.ornaments.addPortal(portal);
// now, at this point, we could match the above re-cluster code - sorting, and adding/removing as necessary
// however, it won't make a lot of visible difference compared to just pushing to the end of the list, then
// adding to the visible layer if the list is below the limit
if (this.portalClusters[cid].length < this.CLUSTER_PORTAL_LIMIT || portal.options.guid == selectedPortal || artifact.isInterestingPortal(portal.options.guid)) {
if(this.portalClusters[cid].length < this.CLUSTER_PORTAL_LIMIT
|| portal.options.guid == selectedPortal
|| artifact.isInterestingPortal(portal.options.guid)
|| ornaments.isInterestingPortal(portal)) {
if (this.bounds.contains(portal.getLatLng())) {
portalsFactionLayers[parseInt(portal.options.level)][portal.options.team].addLayer(portal);
}
@ -471,6 +476,8 @@ window.Render.prototype.removePortalFromMapLayer = function(portal) {
//remove it from the portalsLevels layer
portalsFactionLayers[parseInt(portal.options.level)][portal.options.team].removeLayer(portal);
window.ornaments.removePortal(portal);
// and ensure there's no mention of the portal in the cluster list
var cid = this.getPortalClusterID(portal);