Fixes ipas-link in the case that resos are missing

Adds dummy values to the hash, with energyTotal=0 for that resonator
This commit is contained in:
wrycta 2013-04-11 10:34:57 +08:00
parent a7f97fa5ba
commit 56e79fe10c

View File

@ -33,7 +33,12 @@ window.plugin.ipasLink.addLink = function(d) {
window.plugin.ipasLink.getHash = function(d) { window.plugin.ipasLink.getHash = function(d) {
var hashParts=[]; var hashParts=[];
$.each(d.resonatorArray.resonators, function(ind, reso) { $.each(d.resonatorArray.resonators, function(ind, reso) {
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal); if ($reso) {
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
} else {
hashParts.push(1 + "," + 35 + "," + 0); // Dummy values, the only important one is energy=0
}
}
}); });
return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet
} }