[missions] bugfix: mwpid now includes waypoint index

otherwise, you wouldn't be able to mark waypoints for hidden missions or duplicate portals (i.e. when a portal appears more than once in a mission)
This commit is contained in:
fkloft 2015-04-16 00:11:03 +02:00
parent 933843bd68
commit d682ba17c7

View File

@ -487,7 +487,7 @@ window.plugin.missions = {
else else
title.textContent = 'Unknown'; title.textContent = 'Unknown';
var mwpid = mission.guid + '-' + waypoint.guid; var mwpid = mission.guid + '-' + index + '-' + waypoint.guid;
var checked = this.checkedWaypoints[mwpid]; var checked = this.checkedWaypoints[mwpid];
var label = container.appendChild(document.createElement('label')); var label = container.appendChild(document.createElement('label'));
@ -495,7 +495,7 @@ window.plugin.missions = {
var checkbox = label.appendChild(document.createElement('input')); var checkbox = label.appendChild(document.createElement('input'));
checkbox.type = 'checkbox'; checkbox.type = 'checkbox';
checkbox.addEventListener('change', function() { checkbox.addEventListener('change', function() {
plugin.missions.toggleWaypoint(mission.guid, waypoint.guid); plugin.missions.toggleWaypoint(mission.guid, mwpid);
}, false); }, false);
checkbox.dataset['mission_mwpid'] = mwpid; checkbox.dataset['mission_mwpid'] = mwpid;
@ -524,8 +524,7 @@ window.plugin.missions = {
return container; return container;
}, },
toggleWaypoint: function(mid, wpid, dontsave) { toggleWaypoint: function(mid, mwpid, dontsave) {
var mwpid = mid + '-' + wpid;
if(this.checkedWaypoints[mwpid]) if(this.checkedWaypoints[mwpid])
delete this.checkedWaypoints[mwpid]; delete this.checkedWaypoints[mwpid];
else else