From 0043160e305b1edf35f0504c0577ada00405e5b0 Mon Sep 17 00:00:00 2001 From: biwa Date: Fri, 19 Apr 2019 16:14:30 +0200 Subject: [PATCH] - Fixed an issue where the current editing mode was not re-initialized properly when opening a map from current WAD --- Source/Core/General/MapManager.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index ec4f0b9..467f216 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -543,13 +543,17 @@ namespace CodeImp.DoomBuilder if(General.Editing.Mode != null) { - if(General.Editing.Mode is ClassicMode) + if (General.Editing.Mode is ClassicMode) { ClassicMode mode = (ClassicMode)General.Editing.Mode; mode.OnRedoEnd(); + // biwa. Cancel current mode. This will re-engage non-volatile modes to make sure it's + // properly initialized for the new map. Fixes issues mentioned in #196 + General.Editing.CancelMode(); + // Center map in screen or on stored coordinates - if(options.ViewPosition.IsFinite() && !float.IsNaN(options.ViewScale)) + if (options.ViewPosition.IsFinite() && !float.IsNaN(options.ViewScale)) mode.CenterOnCoordinates(options.ViewPosition, options.ViewScale); else mode.CenterInScreen(); @@ -557,12 +561,16 @@ namespace CodeImp.DoomBuilder else if(General.Editing.Mode is VisualMode) { VisualMode mode = (VisualMode)General.Editing.Mode; - + + // biwa. Cancel current mode. This will re-engage non-volatile modes to make sure it's + // properly initialized for the new map. Fixes issues mentioned in #196 + General.Editing.CancelMode(); + // This will rebuild blockmap, among the other things General.Editing.Mode.OnReloadResources(); // Update camera position - if(options.ViewPosition.IsFinite()) mode.CenterOnCoordinates(options.ViewPosition); + if (options.ViewPosition.IsFinite()) mode.CenterOnCoordinates(options.ViewPosition); } }