Check for when the next mission is disabled will now not fail if the next mission in line is also disabled.

This commit is contained in:
fire bingo 2018-10-24 23:01:44 -07:00
parent 99c7afde04
commit 9ca07cca3b
2 changed files with 22 additions and 3 deletions

View File

@ -255,7 +255,16 @@ function missionChanged(mstId, value) {
currentMission = newMission;
currentMissionMst = mstId;
if(!currentMission.Enabled) {
missionChanged(currentMissionMst, mst.Missions[currentMissionList[currentMissionIndex+1]].Id);
//Check for the next enabled mission. If there are none just reset.
for(let i = currentMissionIndex + 1; i < currentMissionList.length; ++i) {
const mis = mst.Missions[currentMissionList[i]];
if(mis && mis.Enabled) {
missionChanged(currentMissionMst, mis.Id);
return;
}
}
//If we got through the loop there are no more enabled so just end
resetMissions();
return;
}
let promises = [];
@ -349,7 +358,17 @@ function skipClicked(event) {
} else if(player.runEvent && currentMissionIndex !== currentMissionList.length - 1) {
event.preventDefault();
event.stopPropagation();
missionChanged(currentMissionMst, utage.groupedMissions[currentMissionMst].Missions[currentMissionList[currentMissionIndex+1]].Id);
//Find the next enabled mission
for(let i = currentMissionIndex + 1; i < currentMissionList.length; ++i) {
const mis = utage.groupedMissions[currentMissionMst].Missions[currentMissionList[i]];
if(mis && mis.Enabled) {
//missionChanged(currentMissionMst, utage.groupedMissions[currentMissionMst].Missions[currentMissionList[currentMissionIndex+1]].Id);
missionChanged(currentMissionMst, mis.Id);
return;
}
}
//If we got through the loop there are no more enabled so just end
resetMissions();
}
}

@ -1 +1 @@
Subproject commit fe1fa06db3afc7fd1a8f967adf6e105cd26fc963
Subproject commit 533c48371ed01ed7265b6b5f052d1b2c3fce940f