- fixed bug which caused thing arguments to mess up

- backups are created when saving file (up to 3)
This commit is contained in:
codeimp 2009-01-04 22:26:23 +00:00
parent 142877f5dc
commit 40c69c9e6e
4 changed files with 12 additions and 6 deletions

View file

@ -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))

View file

@ -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?

View file

@ -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

View file

@ -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<string,bool>(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);
}