Bug Fix: minLevel of Portal Render Limit handler now persistent in same batch of request.
This commit is contained in:
parent
17a81c09d9
commit
82792cf4be
@ -43,6 +43,8 @@ window.requestData = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset previous result of Portal Render Limit handler
|
||||||
|
PRL.init();
|
||||||
// finally send ajax requests
|
// finally send ajax requests
|
||||||
$.each(tiles, function(ind, tls) {
|
$.each(tiles, function(ind, tls) {
|
||||||
data = { minLevelOfDetail: -1 };
|
data = { minLevelOfDetail: -1 };
|
||||||
@ -70,7 +72,8 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
// https://github.com/Leaflet/Leaflet/issues/185
|
// https://github.com/Leaflet/Leaflet/issues/185
|
||||||
var ppp = [];
|
var ppp = [];
|
||||||
var p2f = {};
|
var p2f = {};
|
||||||
PRL.resetOrInit();
|
// Reset new portals count of Portal Render Limit handler
|
||||||
|
PRL.resetCounting();
|
||||||
$.each(m, function(qk, val) {
|
$.each(m, function(qk, val) {
|
||||||
$.each(val.deletedGameEntityGuids, function(ind, guid) {
|
$.each(val.deletedGameEntityGuids, function(ind, guid) {
|
||||||
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {
|
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {
|
||||||
|
@ -2,14 +2,19 @@
|
|||||||
|
|
||||||
// UTILS + MISC ///////////////////////////////////////////////////////
|
// UTILS + MISC ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
// PRL - Portal Render Limit
|
// PRL - Portal Render Limit handler
|
||||||
window.PRL = function() {}
|
window.PRL = function() {}
|
||||||
|
|
||||||
window.PRL.resetOrInit = function () {
|
window.PRL.init = function () {
|
||||||
PRL.initialized = true;
|
PRL.initialized = true;
|
||||||
PRL.minLevel = -1;
|
PRL.minLevel = -1;
|
||||||
|
PRL.resetCounting();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.PRL.resetCounting = function() {
|
||||||
PRL.minLevelSet = false;
|
PRL.minLevelSet = false;
|
||||||
PRL.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL+1);
|
if(!PRL.newPortalsPerLevel)
|
||||||
|
PRL.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL+1);
|
||||||
for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
|
for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
|
||||||
PRL.newPortalsPerLevel[i] = 0;
|
PRL.newPortalsPerLevel[i] = 0;
|
||||||
}
|
}
|
||||||
@ -32,19 +37,21 @@ window.PRL.getMinLevel = function() {
|
|||||||
|
|
||||||
window.PRL.setMinLevel = function() {
|
window.PRL.setMinLevel = function() {
|
||||||
var totalPortalsCount = 0;
|
var totalPortalsCount = 0;
|
||||||
PRL.minLevel = MAX_PORTAL_LEVEL + 1;
|
var newMinLevel = MAX_PORTAL_LEVEL + 1;
|
||||||
|
|
||||||
// Find the min portal level under render limit
|
// Find the min portal level under render limit
|
||||||
while(PRL.minLevel > 0) {
|
while(newMinLevel > 0) {
|
||||||
var oldPortalCount = layerGroupLength(portalsLayers[PRL.minLevel - 1]);
|
var oldPortalCount = layerGroupLength(portalsLayers[newMinLevel - 1]);
|
||||||
totalPortalsCount += oldPortalCount + PRL.newPortalsPerLevel[PRL.minLevel - 1];
|
totalPortalsCount += oldPortalCount + PRL.newPortalsPerLevel[newMinLevel - 1];
|
||||||
if(totalPortalsCount >= MAX_DRAWN_PORTALS)
|
if(totalPortalsCount >= MAX_DRAWN_PORTALS)
|
||||||
break;
|
break;
|
||||||
PRL.minLevel--;
|
newMinLevel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If render limit reached at max portal level, still let portal at max level render
|
// If render limit reached at max portal level, still let portal at max level render
|
||||||
if(PRL.minLevel === MAX_PORTAL_LEVEL + 1) PRL.minLevel = MAX_PORTAL_LEVEL;
|
if(newMinLevel === MAX_PORTAL_LEVEL + 1) newMinLevel = MAX_PORTAL_LEVEL;
|
||||||
|
|
||||||
|
if(newMinLevel > PRL.minLevel) PRL.minLevel = newMinLevel;
|
||||||
PRL.minLevelSet = true;
|
PRL.minLevelSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user