diff --git a/Source/General/MapManager.cs b/Source/General/MapManager.cs index 4862b5aa..56b1597c 100644 --- a/Source/General/MapManager.cs +++ b/Source/General/MapManager.cs @@ -475,6 +475,15 @@ namespace CodeImp.DoomBuilder try { + // Backup existing file, if any + if(File.Exists(newfilepathname)) + { + if(File.Exists(newfilepathname + ".backup3")) File.Delete(newfilepathname + ".backup3"); + if(File.Exists(newfilepathname + ".backup2")) File.Move(newfilepathname + ".backup2", newfilepathname + ".backup3"); + if(File.Exists(newfilepathname + ".backup1")) File.Move(newfilepathname + ".backup1", newfilepathname + ".backup2"); + File.Copy(newfilepathname, newfilepathname + ".backup1"); + } + // Except when saving INTO another file, // kill the target file if it is different from source file if((savemode != SAVE_INTO) && (newfilepathname != filepathname)) diff --git a/Source/IO/DoomMapSetIO.cs b/Source/IO/DoomMapSetIO.cs index b7fe9109..df6712d2 100644 --- a/Source/IO/DoomMapSetIO.cs +++ b/Source/IO/DoomMapSetIO.cs @@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.IO // Create new item t = map.CreateThing(); - t.Update(type, x, y, 0, angle, stringflags, 0, 0, Thing.EMPTY_ARGS); + t.Update(type, x, y, 0, angle, stringflags, 0, 0, new int[Thing.NUM_ARGS]); //t.DetermineSector(); t.UpdateConfiguration(); } @@ -274,7 +274,7 @@ namespace CodeImp.DoomBuilder.IO // Create new item l = map.CreateLinedef(vertexlink[v1], vertexlink[v2]); - l.Update(stringflags, 0, tag, action, Linedef.EMPTY_ARGS); + l.Update(stringflags, 0, tag, action, new int[Linedef.NUM_ARGS]); l.UpdateCache(); // Line has a front side? diff --git a/Source/Map/Linedef.cs b/Source/Map/Linedef.cs index 19fd673a..84a549cf 100644 --- a/Source/Map/Linedef.cs +++ b/Source/Map/Linedef.cs @@ -38,7 +38,6 @@ namespace CodeImp.DoomBuilder.Map public const float SIDE_POINT_DISTANCE = 0.001f; public const int NUM_ARGS = 5; - public static readonly int[] EMPTY_ARGS = new int[NUM_ARGS]; #endregion diff --git a/Source/Map/Thing.cs b/Source/Map/Thing.cs index 8532360a..1e95f559 100644 --- a/Source/Map/Thing.cs +++ b/Source/Map/Thing.cs @@ -37,7 +37,6 @@ namespace CodeImp.DoomBuilder.Map #region ================== Constants public const int NUM_ARGS = 5; - public static readonly int[] EMPTY_ARGS = new int[NUM_ARGS]; #endregion @@ -178,12 +177,11 @@ namespace CodeImp.DoomBuilder.Map t.flags = new Dictionary(flags); t.tag = tag; t.action = action; - t.args = EMPTY_ARGS; + t.args = (int[])args.Clone(); t.size = size; t.color = color; t.iconoffset = iconoffset; t.fixedsize = fixedsize; - args.CopyTo(t.args, 0); base.CopyPropertiesTo(t); }