Fix reporting bug when doing replay

This commit is contained in:
Tim Young 2018-10-08 11:52:53 -05:00
parent de5acab132
commit 2ca9ddce19
2 changed files with 15 additions and 3 deletions

View File

@ -874,7 +874,7 @@ namespace EduNetworkBuilder
return tDests; return tDests;
} }
public void TestForCompletion(bool report_as_done) public void TestForCompletion(bool report_as_done, bool MarkAsDoneIfNotReporting=false)
{ {
NetworkDevice TmpDevice; NetworkDevice TmpDevice;
bool PreviouslyUnsolved = !PuzzleIsSolved; //Only if we have an unsolved puzzle bool PreviouslyUnsolved = !PuzzleIsSolved; //Only if we have an unsolved puzzle
@ -911,7 +911,8 @@ namespace EduNetworkBuilder
} }
if (PuzzleCount == 0 && PreviouslyUnsolved) if (PuzzleCount == 0 && PreviouslyUnsolved)
{ {
PuzzleIsSolved = true; if(report_as_done || MarkAsDoneIfNotReporting)
PuzzleIsSolved = true; //Only change this when we need to report it
if (NB.DebugTests) Console.WriteLine("Recognizing puzzle is solved: " + PuzzleName); if (NB.DebugTests) Console.WriteLine("Recognizing puzzle is solved: " + PuzzleName);
if (report_as_done) if (report_as_done)
{ {
@ -1707,7 +1708,7 @@ namespace EduNetworkBuilder
//replay finished //replay finished
ReplayInProgress = false; ReplayInProgress = false;
//Try testing for completion? //Try testing for completion?
TestForCompletion(false); TestForCompletion(false, true);
//If we have succeeded, we need to mark it as passed //If we have succeeded, we need to mark it as passed
if (PuzzleIsSolved) Settings.RegisterReplayPassed(); if (PuzzleIsSolved) Settings.RegisterReplayPassed();
//If we have failed to complete, we need to mark it as failed //If we have failed to complete, we need to mark it as failed

View File

@ -2043,6 +2043,17 @@ namespace EduNetworkBuilder
LoadNetworkFromNetwork(theNet); LoadNetworkFromNetwork(theNet);
} }
} }
if(OurSettings.ReplayMode)
{
//clear out the replay actions for this network
ActionCollection AC = OurSettings.GetUserActionCollection();
if (AC != null)
{
NetworkAction NA = AC.GetCurrentNetAction();
if (NA != null)
NA.Actions.Clear();
}
}
UpdateMenu(); UpdateMenu();
UpdateForm(); UpdateForm();
} }