From fbb30f6f91290532c6f986797130f99e5d3ad4f4 Mon Sep 17 00:00:00 2001 From: MaxED <j.maxed@gmail.com> Date: Mon, 18 Jan 2016 11:39:59 +0000 Subject: [PATCH] Fixed, "Open map in current wad" action: MAPINFO data must be updated when using the action. Changed, "Open map in current wad" action: current map resources are now carried over to the map being switched to. --- Source/Core/Data/DataManager.cs | 10 ++++++++-- Source/Core/General/General.cs | 20 -------------------- Source/Core/General/MapManager.cs | 3 +++ Source/Core/Windows/ChangeMapForm.cs | 1 + 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 6737305ea..134fcef18 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -366,8 +366,7 @@ namespace CodeImp.DoomBuilder.Data LoadSprites(); //mxd. Load MAPINFO. Should happen before parisng DECORATE - Dictionary<int, string> spawnnums; - Dictionary<int, string> doomednums; + Dictionary<int, string> spawnnums, doomednums; LoadMapInfo(out spawnnums, out doomednums); int thingcount = LoadDecorateThings(spawnnums, doomednums); @@ -2077,6 +2076,13 @@ namespace CodeImp.DoomBuilder.Data skyboxes = parser.Skyboxes; } + //mxd. This updates mapinfo class only + internal void ReloadMapInfoPartial() + { + Dictionary<int, string> spawnnums, doomednums; + LoadMapInfo(out spawnnums, out doomednums); + } + //mxd. This loads (Z)MAPINFO private void LoadMapInfo(out Dictionary<int, string> spawnnums, out Dictionary<int, string> doomednums) { diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index 87ca2afd1..c7420e183 100644 --- a/Source/Core/General/General.cs +++ b/Source/Core/General/General.cs @@ -1242,26 +1242,6 @@ namespace CodeImp.DoomBuilder ChangeMapForm changemapwindow = new ChangeMapForm(map.FilePathName, map.Options); if(changemapwindow.ShowDialog(mainwindow) != DialogResult.OK) return; - // If resources don't match, perform regular map loading - bool resourcesmismatch = changemapwindow.Options.Resources.Count != map.Options.Resources.Count; - if(!resourcesmismatch) - { - for(int i = 0; i < changemapwindow.Options.Resources.Count; i++) - { - if(changemapwindow.Options.Resources[i].location != map.Options.Resources[i].location) - { - resourcesmismatch = true; - break; - } - } - } - - if(resourcesmismatch) - { - OpenMapFileWithOptions(map.FilePathName, changemapwindow.Options); - return; - } - // Display status mainwindow.DisplayStatus(StatusType.Busy, "Switching to map '" + changemapwindow.Options.CurrentName + "'..."); WriteLogLine("Switching to map '" + changemapwindow.Options.CurrentName + "'..."); diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index 994019f9f..0cf752089 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -526,6 +526,9 @@ namespace CodeImp.DoomBuilder // Sector textures may've been changed data.UpdateUsedTextures(); + // This will update DataManager.mapinfo only + data.ReloadMapInfoPartial(); + // Skybox may've been changed data.SetupSkybox(); diff --git a/Source/Core/Windows/ChangeMapForm.cs b/Source/Core/Windows/ChangeMapForm.cs index caebf2904..702ac715e 100644 --- a/Source/Core/Windows/ChangeMapForm.cs +++ b/Source/Core/Windows/ChangeMapForm.cs @@ -198,6 +198,7 @@ namespace CodeImp.DoomBuilder.Windows MapOptions newoptions = new MapOptions(mapsettings, mapslist.SelectedItems[0].Text, options.UseLongTextureNames); newoptions.ConfigFile = options.ConfigFile; newoptions.ScriptCompiler = options.ScriptCompiler; + newoptions.CopyResources(options.Resources); options = newoptions; // Hide window -- GitLab