From 287d1fe968314fb834ca780531d72d4d681fb275 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 23 Jan 2016 09:40:17 +0100 Subject: [PATCH] Merged in GZDB r2478. --- Source/Core/Data/DataManager.cs | 14 ++++++++++---- Source/Core/General/General.cs | 20 -------------------- Source/Core/General/MapManager.cs | 3 +++ Source/Core/Windows/ChangeMapForm.cs | 3 ++- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 2c624f8..081e918 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -365,10 +365,9 @@ namespace CodeImp.DoomBuilder.Data int colormapcount = LoadColormaps(colormapsonly); LoadSprites(); - //mxd. Load MAPINFO. Should happen before parisng DECORATE - Dictionary spawnnums; - Dictionary doomednums; - LoadMapInfo(out spawnnums, out doomednums); + //mxd. Load MAPINFO. Should happen before parisng DECORATE + Dictionary spawnnums, doomednums; + LoadMapInfo(out spawnnums, out doomednums); int thingcount = LoadDecorateThings(spawnnums, doomednums); int spritecount = LoadThingSprites(); @@ -2083,6 +2082,13 @@ namespace CodeImp.DoomBuilder.Data skyboxes = parser.Skyboxes; } + //mxd. This updates mapinfo class only + internal void ReloadMapInfoPartial() + { + Dictionary spawnnums, doomednums; + LoadMapInfo(out spawnnums, out doomednums); + } + //mxd. This loads (Z)MAPINFO private void LoadMapInfo(out Dictionary spawnnums, out Dictionary doomednums) { diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index cf12193..0e46f7a 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 018c8b8..90df316 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -527,6 +527,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 55d06e8..192b13f 100644 --- a/Source/Core/Windows/ChangeMapForm.cs +++ b/Source/Core/Windows/ChangeMapForm.cs @@ -198,7 +198,8 @@ namespace CodeImp.DoomBuilder.Windows MapOptions newoptions = new MapOptions(mapsettings, mapslist.SelectedItems[0].Text, options.UseLongTextureNames); newoptions.ConfigFile = options.ConfigFile; newoptions.ScriptCompiler = options.ScriptCompiler; - options = newoptions; + newoptions.CopyResources(options.Resources); + options = newoptions; // Hide window this.DialogResult = DialogResult.OK;