From c3cc910e0eb046afe271aa2ec6a06eea0c6e9392 Mon Sep 17 00:00:00 2001 From: codeimp Date: Thu, 1 May 2008 14:18:04 +0000 Subject: [PATCH] user selection preserved through undo/redo --- Source/Map/Linedef.cs | 1 + Source/Map/MapSet.cs | 16 +++------------- Source/Map/Sector.cs | 1 + Source/Map/Thing.cs | 1 + Source/Map/Vertex.cs | 1 + 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Source/Map/Linedef.cs b/Source/Map/Linedef.cs index 29e59b8f..d4a40e97 100644 --- a/Source/Map/Linedef.cs +++ b/Source/Map/Linedef.cs @@ -195,6 +195,7 @@ namespace CodeImp.DoomBuilder.Map l.tag = tag; l.updateneeded = true; if(fields != null) l.MakeFields(fields); + l.selected = selected; } // This attaches a sidedef on the front diff --git a/Source/Map/MapSet.cs b/Source/Map/MapSet.cs index b358fd21..b099d0ae 100644 --- a/Source/Map/MapSet.cs +++ b/Source/Map/MapSet.cs @@ -156,17 +156,15 @@ namespace CodeImp.DoomBuilder.Map { // Make new vertex v.Clone = newset.CreateVertex(v.X, v.Y); + v.CopyPropertiesTo(v.Clone); } // Go for all sectors foreach(Sector s in sectors) { // Make new sector - Sector ns = newset.CreateSector(); - s.Clone = ns; - - // Copy properties - s.CopyPropertiesTo(ns); + s.Clone = newset.CreateSector(); + s.CopyPropertiesTo(s.Clone); } // Go for all linedefs @@ -174,8 +172,6 @@ namespace CodeImp.DoomBuilder.Map { // Make new linedef nl = newset.CreateLinedef(l.Start.Clone, l.End.Clone); - - // Copy properties l.CopyPropertiesTo(nl); // Linedef has a front side? @@ -183,8 +179,6 @@ namespace CodeImp.DoomBuilder.Map { // Make new sidedef nd = newset.CreateSidedef(nl, true, l.Front.Sector.Clone); - - // Copy properties l.Front.CopyPropertiesTo(nd); } @@ -193,8 +187,6 @@ namespace CodeImp.DoomBuilder.Map { // Make new sidedef nd = newset.CreateSidedef(nl, false, l.Back.Sector.Clone); - - // Copy properties l.Back.CopyPropertiesTo(nd); } } @@ -204,8 +196,6 @@ namespace CodeImp.DoomBuilder.Map { // Make new thing Thing nt = newset.CreateThing(); - - // Copy properties t.CopyPropertiesTo(nt); } diff --git a/Source/Map/Sector.cs b/Source/Map/Sector.cs index 62e7bc0e..9df90f54 100644 --- a/Source/Map/Sector.cs +++ b/Source/Map/Sector.cs @@ -170,6 +170,7 @@ namespace CodeImp.DoomBuilder.Map s.tag = tag; s.brightness = brightness; if(fields != null) s.MakeFields(fields); + s.selected = selected; } // This attaches a sidedef and returns the listitem diff --git a/Source/Map/Thing.cs b/Source/Map/Thing.cs index 5fc6b241..679381de 100644 --- a/Source/Map/Thing.cs +++ b/Source/Map/Thing.cs @@ -162,6 +162,7 @@ namespace CodeImp.DoomBuilder.Map t.iconoffset = iconoffset; args.CopyTo(t.args, 0); if(fields != null) t.MakeFields(fields); + t.selected = selected; } // This determines which sector the thing is in and links it diff --git a/Source/Map/Vertex.cs b/Source/Map/Vertex.cs index fb92a060..d23d83ee 100644 --- a/Source/Map/Vertex.cs +++ b/Source/Map/Vertex.cs @@ -178,6 +178,7 @@ namespace CodeImp.DoomBuilder.Map v.y = y; v.pos = pos; if(fields != null) v.MakeFields(fields); + v.selected = selected; } // This returns the distance from given coordinates