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
|
||||
$.each(tiles, function(ind, tls) {
|
||||
data = { minLevelOfDetail: -1 };
|
||||
@ -70,7 +72,8 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
||||
// https://github.com/Leaflet/Leaflet/issues/185
|
||||
var ppp = [];
|
||||
var p2f = {};
|
||||
PRL.resetOrInit();
|
||||
// Reset new portals count of Portal Render Limit handler
|
||||
PRL.resetCounting();
|
||||
$.each(m, function(qk, val) {
|
||||
$.each(val.deletedGameEntityGuids, function(ind, guid) {
|
||||
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {
|
||||
|
@ -2,13 +2,18 @@
|
||||
|
||||
// UTILS + MISC ///////////////////////////////////////////////////////
|
||||
|
||||
// PRL - Portal Render Limit
|
||||
// PRL - Portal Render Limit handler
|
||||
window.PRL = function() {}
|
||||
|
||||
window.PRL.resetOrInit = function () {
|
||||
window.PRL.init = function () {
|
||||
PRL.initialized = true;
|
||||
PRL.minLevel = -1;
|
||||
PRL.resetCounting();
|
||||
}
|
||||
|
||||
window.PRL.resetCounting = function() {
|
||||
PRL.minLevelSet = false;
|
||||
if(!PRL.newPortalsPerLevel)
|
||||
PRL.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL+1);
|
||||
for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
|
||||
PRL.newPortalsPerLevel[i] = 0;
|
||||
@ -32,19 +37,21 @@ window.PRL.getMinLevel = function() {
|
||||
|
||||
window.PRL.setMinLevel = function() {
|
||||
var totalPortalsCount = 0;
|
||||
PRL.minLevel = MAX_PORTAL_LEVEL + 1;
|
||||
var newMinLevel = MAX_PORTAL_LEVEL + 1;
|
||||
|
||||
// Find the min portal level under render limit
|
||||
while(PRL.minLevel > 0) {
|
||||
var oldPortalCount = layerGroupLength(portalsLayers[PRL.minLevel - 1]);
|
||||
totalPortalsCount += oldPortalCount + PRL.newPortalsPerLevel[PRL.minLevel - 1];
|
||||
while(newMinLevel > 0) {
|
||||
var oldPortalCount = layerGroupLength(portalsLayers[newMinLevel - 1]);
|
||||
totalPortalsCount += oldPortalCount + PRL.newPortalsPerLevel[newMinLevel - 1];
|
||||
if(totalPortalsCount >= MAX_DRAWN_PORTALS)
|
||||
break;
|
||||
PRL.minLevel--;
|
||||
newMinLevel--;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user