From 5f42c6a2d041bcc3979ea647a92de1a155827c64 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Tue, 5 Feb 2013 16:06:57 +0100 Subject: [PATCH] fix portal range being larger zero even if resos are missing --- code/portal_info.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/portal_info.js b/code/portal_info.js index 62cd8777..c75d748d 100644 --- a/code/portal_info.js +++ b/code/portal_info.js @@ -29,6 +29,17 @@ window.getPortalEnergy = function(d) { window.getPortalRange = function(d) { // formula by the great gals and guys at // http://decodeingress.me/2012/11/18/ingress-portal-levels-and-link-range/ + + var lvl = 0; + var resoMissing = false; + $.each(d.resonatorArray.resonators, function(ind, reso) { + if(!reso) { + resoMissing = true; + return false; + } + lvl += parseInt(reso.level); + }); + if(resoMissing) return 0; return 160*Math.pow(getPortalLevel(d), 4); }