From b66db19c0a6a7c42fd3ce4bb36d88becfd44bda7 Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 17 Jan 2019 15:07:50 -0800 Subject: [PATCH] Fix post world generation behavior --- Torch.Server/Managers/InstanceManager.cs | 10 +++++++++- Torch.Server/Views/WorldGeneratorDialog.xaml.cs | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Torch.Server/Managers/InstanceManager.cs b/Torch.Server/Managers/InstanceManager.cs index 245f8d1..b47cb4e 100644 --- a/Torch.Server/Managers/InstanceManager.cs +++ b/Torch.Server/Managers/InstanceManager.cs @@ -87,7 +87,15 @@ namespace Torch.Server.Managers public void SelectWorld(string worldPath, bool modsOnly = true) { DedicatedConfig.LoadWorld = worldPath; - DedicatedConfig.SelectedWorld = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath); + + var worldInfo = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath); + if (worldInfo?.Checkpoint == null) + { + worldInfo = new WorldViewModel(worldPath); + DedicatedConfig.Worlds.Add(worldInfo); + } + + DedicatedConfig.SelectedWorld = worldInfo; if (DedicatedConfig.SelectedWorld?.Checkpoint != null) { DedicatedConfig.Mods.Clear(); diff --git a/Torch.Server/Views/WorldGeneratorDialog.xaml.cs b/Torch.Server/Views/WorldGeneratorDialog.xaml.cs index cfbfad8..eec25de 100644 --- a/Torch.Server/Views/WorldGeneratorDialog.xaml.cs +++ b/Torch.Server/Views/WorldGeneratorDialog.xaml.cs @@ -93,7 +93,6 @@ namespace Torch.Server _instanceManager.SelectWorld(worldPath, false); - _instanceManager.LoadInstance(worldPath); _instanceManager.ImportSelectedWorldConfig(); Close(); }