Skip to content
Snippets Groups Projects
Commit 98963ba0 authored by Marco Zimmer's avatar Marco Zimmer
Browse files

fixed level creation/ instantiation

parent 30bdb6eb
Branches
No related tags found
No related merge requests found
...@@ -89,7 +89,7 @@ public List<Fact> getMasterFactsByIndex (int i) ...@@ -89,7 +89,7 @@ public List<Fact> getMasterFactsByIndex (int i)
return ValidationSet[i].MasterIDs.Select(id => this[id]).ToList(); return ValidationSet[i].MasterIDs.Select(id => this[id]).ToList();
} }
public new void store(string name, List<Directories> hierarchie = null, bool use_install_folder = false) public new void store(string name, List<Directories> hierarchie = null, bool use_install_folder = false, bool overwrite = true)
{ {
hierarchie ??= new List<Directories>(); hierarchie ??= new List<Directories>();
hierarchie.AddRange(hierVal.AsEnumerable()); hierarchie.AddRange(hierVal.AsEnumerable());
...@@ -97,11 +97,17 @@ public List<Fact> getMasterFactsByIndex (int i) ...@@ -97,11 +97,17 @@ public List<Fact> getMasterFactsByIndex (int i)
base.store(name + endingSol, hierarchie, use_install_folder); base.store(name + endingSol, hierarchie, use_install_folder);
string path_o = path_Val; string path_o = path_Val;
path_Val = CreatePathToFile(out _, name + endingVal, "JSON", hierarchie, use_install_folder); path_Val = CreatePathToFile(out bool exists, name + endingVal, "JSON", hierarchie, use_install_folder);
hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count);
if (exists && !overwrite)
{
path_Val = path_o;
return;
}
JSONManager.WriteToJsonFile(path_Val, this.ValidationSet, 0); JSONManager.WriteToJsonFile(path_Val, this.ValidationSet, 0);
path_Val = path_o; path_Val = path_o;
hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count);
} }
public static bool load(ref SolutionOrganizer set, bool draw, string name, List<Directories> hierarchie = null, bool use_install_folder = false) public static bool load(ref SolutionOrganizer set, bool draw, string name, List<Directories> hierarchie = null, bool use_install_folder = false)
......
...@@ -274,8 +274,9 @@ public void store(bool reset_player = false) ...@@ -274,8 +274,9 @@ public void store(bool reset_player = false)
path = path_o; path = path_o;
hierarchie.AddRange(hierStage.AsEnumerable()); hierarchie.AddRange(hierStage.AsEnumerable());
if(solution != null && solution.ValidationSet.Count > 0 && !solution.ValidationSet.Aggregate(false, (last, next) => last || next.IsEmpty())) if(solution != null)
solution.store(name, hierarchie, use_install_folder); solution.store(name, hierarchie, use_install_folder,
overwrite: solution.ValidationSet.Count > 0 && !solution.ValidationSet.Aggregate(false, (last, next) => last || next.IsEmpty()));
} }
if (player_record != null) if (player_record != null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment