From c6ea3f2bd0a1c6c3776f77869a8568f2a5e2ef63 Mon Sep 17 00:00:00 2001 From: num0005 Date: Fri, 22 Oct 2021 12:07:15 +0100 Subject: [PATCH] Fix issues pointed out in code review. --- Launcher/MainWindow.xaml.cs | 2 +- Launcher/ToolkitInterface/H2Toolkit.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Launcher/MainWindow.xaml.cs b/Launcher/MainWindow.xaml.cs index 7da2a23..53d09fd 100644 --- a/Launcher/MainWindow.xaml.cs +++ b/Launcher/MainWindow.xaml.cs @@ -717,7 +717,7 @@ private async void CompileLevel(string level_path, string bsp_path, string Level var info = ToolkitBase.SplitStructureFilename(level_path, bsp_path); var scen_path = Path.Combine(info.ScenarioPath, info.ScenarioName); CancelableProgressBarWindow progress = null; - if (halo_3 || (halo_2_mcc && lightmaps_args.instanceCount > 1) || (halo_2_standalone_community && lightmaps_args.instanceCount > 1)) + if (halo_3 || ((halo_2_mcc || halo_2_standalone_community) && lightmaps_args.instanceCount > 1)) progress = new CancelableProgressBarWindow(); try { diff --git a/Launcher/ToolkitInterface/H2Toolkit.cs b/Launcher/ToolkitInterface/H2Toolkit.cs index d0de51b..0232463 100644 --- a/Launcher/ToolkitInterface/H2Toolkit.cs +++ b/Launcher/ToolkitInterface/H2Toolkit.cs @@ -4,6 +4,7 @@ using static ToolkitLauncher.ToolkitProfiles; using System.IO; using System.Threading; +using System.Diagnostics; namespace ToolkitLauncher.ToolkitInterface { @@ -59,7 +60,7 @@ public override async Task BuildLightmap(string scenario, string bsp, LightmapAr { string quality = GetLightmapQuality(args); - if ((args.instanceCount > 1 && Profile.IsMCC) || (args.instanceCount > 1 && Profile.CommunityTools)) + if (args.instanceCount > 1 && (Profile.IsMCC || Profile.CommunityTools)) // multi instance? { if (progress is not null) progress.MaxValue += 1 + args.instanceCount; @@ -68,7 +69,7 @@ async Task RunInstance(int index) { if (index == 0 && !Profile.IsH2Codez()) // not needed for H2Codez { - if (progress is not null && args.instanceCount > 1) + if (progress is not null) progress.Status = "Delaying launch of zeroth instance"; await Task.Delay(1000 * 70, progress.GetCancellationToken()); } @@ -105,6 +106,7 @@ async Task RunInstance(int index) } else { + Debug.Assert(args.instanceCount == 1); // should be one, otherwise we got bad args if (progress is not null) { progress.DisableCancellation();