From 869113c389b3b2449c762d59dd76fe1029f9994e Mon Sep 17 00:00:00 2001 From: codeimp Date: Mon, 10 Nov 2008 21:06:02 +0000 Subject: [PATCH] Fixed major bug in MapSet IO implementations (how can I have missed this?!) --- Source/General/MapManager.cs | 14 +++++++++++--- Source/IO/DoomMapSetIO.cs | 10 +++++----- Source/IO/HexenMapSetIO.cs | 10 +++++----- Source/IO/UniversalMapSetIO.cs | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Source/General/MapManager.cs b/Source/General/MapManager.cs index e64c4242..4d300152 100644 --- a/Source/General/MapManager.cs +++ b/Source/General/MapManager.cs @@ -852,7 +852,7 @@ namespace CodeImp.DoomBuilder } } } - + // Nothing found return -1; } @@ -1099,8 +1099,16 @@ namespace CodeImp.DoomBuilder // This checks if the scripts are changed internal bool CheckScriptChanged() { - // Check if lumps are changed - return scriptschanged || scriptwindow.Editor.CheckImplicitChanges(); + if(scriptwindow != null) + { + // Check if scripts are changed + return scriptschanged || scriptwindow.Editor.CheckImplicitChanges(); + } + else + { + // Check if scripts are changed + return scriptschanged; + } } #endregion diff --git a/Source/IO/DoomMapSetIO.cs b/Source/IO/DoomMapSetIO.cs index a28c8e4d..b7fe9109 100644 --- a/Source/IO/DoomMapSetIO.cs +++ b/Source/IO/DoomMapSetIO.cs @@ -375,7 +375,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "THINGS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "THINGS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -407,7 +407,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "VERTEXES", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "VERTEXES", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -462,7 +462,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "LINEDEFS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "LINEDEFS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -498,7 +498,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "SIDEDEFS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "SIDEDEFS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -535,7 +535,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "SECTORS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "SECTORS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; diff --git a/Source/IO/HexenMapSetIO.cs b/Source/IO/HexenMapSetIO.cs index f21e409b..6e60a421 100644 --- a/Source/IO/HexenMapSetIO.cs +++ b/Source/IO/HexenMapSetIO.cs @@ -399,7 +399,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "THINGS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "THINGS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -430,7 +430,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "VERTEXES", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "VERTEXES", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -491,7 +491,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "LINEDEFS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "LINEDEFS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -526,7 +526,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "SIDEDEFS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "SIDEDEFS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; @@ -562,7 +562,7 @@ namespace CodeImp.DoomBuilder.IO } // Find insert position and remove old lump - insertpos = MapManager.RemoveSpecificLump(wad, "SECTORS", position, "", maplumps); + insertpos = MapManager.RemoveSpecificLump(wad, "SECTORS", position, MapManager.TEMP_MAP_HEADER, maplumps); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count; diff --git a/Source/IO/UniversalMapSetIO.cs b/Source/IO/UniversalMapSetIO.cs index 653dd4d9..73eedef0 100644 --- a/Source/IO/UniversalMapSetIO.cs +++ b/Source/IO/UniversalMapSetIO.cs @@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.IO udmfwriter.Write(map, memstream, manager.Config.EngineName); // Find insert position and remove old lump - int insertpos = MapManager.RemoveSpecificLump(wad, "TEXTMAP", position, "", manager.Config.MapLumpNames); + int insertpos = MapManager.RemoveSpecificLump(wad, "TEXTMAP", position, MapManager.TEMP_MAP_HEADER, manager.Config.MapLumpNames); if(insertpos == -1) insertpos = position + 1; if(insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count;