From 9ca07cca3b1b457e73937af02b36685ba74bff17 Mon Sep 17 00:00:00 2001 From: firebingo Date: Wed, 24 Oct 2018 23:01:44 -0700 Subject: [PATCH] Check for when the next mission is disabled will now not fail if the next mission in line is also disabled. --- Js/Main.js | 23 +++++++++++++++++++++-- Js/Translations | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Js/Main.js b/Js/Main.js index d108182..19b5d84 100644 --- a/Js/Main.js +++ b/Js/Main.js @@ -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(); } } diff --git a/Js/Translations b/Js/Translations index fe1fa06..533c483 160000 --- a/Js/Translations +++ b/Js/Translations @@ -1 +1 @@ -Subproject commit fe1fa06db3afc7fd1a8f967adf6e105cd26fc963 +Subproject commit 533c48371ed01ed7265b6b5f052d1b2c3fce940f