fixed two bugs in copy/paste

This commit is contained in:
codeimp 2008-09-23 20:33:56 +00:00
parent 8d3d00372b
commit 2964b1fea9
2 changed files with 35 additions and 27 deletions

View file

@ -760,13 +760,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(pasting)
{
General.Settings.FindDefaultDrawSettings();
// Go for all linedefs in the new geometry
List<Sidedef> newsides = General.Map.Map.GetMarkedSidedefs(true);
for(int i = 0; i < newsides.Count; i++)
{
Sidedef s = newsides[i];
// Connected to a virtual sector?
if(s.Marked && s.Sector.Fields.ContainsKey(MapSet.VirtualSectorField))
{
@ -829,7 +829,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Remove any virtual sectors
General.Map.Map.RemoveVirtualSectors();
}
// Update cached values
General.Map.Map.Update();
@ -1124,8 +1124,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ClearSelection()
{
// Accept changes
General.Map.Map.ClearAllSelected();
General.Map.AcceptMode();
General.Map.Map.ClearAllSelected();
}
#endregion

View file

@ -206,33 +206,41 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected void SelectSector(Sector s, bool selectstate)
{
bool selectionchanged = false;
// Select the sector?
if(selectstate && !s.Selected)
{
orderedselection.Add(s);
s.Selected = true;
selectionchanged = true;
}
// Deselect the sector?
else if(!selectstate && s.Selected)
{
orderedselection.Remove(s);
s.Selected = false;
selectionchanged = true;
}
// Selection changed?
if(selectionchanged)
if(!s.IsDisposed)
{
// Make update lines selection
foreach(Sidedef sd in s.Sidedefs)
// Select the sector?
if(selectstate && !s.Selected)
{
bool front, back;
if(sd.Line.Front != null) front = sd.Line.Front.Sector.Selected; else front = false;
if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false;
sd.Line.Selected = front | back;
orderedselection.Add(s);
s.Selected = true;
selectionchanged = true;
}
// Deselect the sector?
else if(!selectstate && s.Selected)
{
orderedselection.Remove(s);
s.Selected = false;
selectionchanged = true;
}
// Selection changed?
if(selectionchanged)
{
// Make update lines selection
foreach(Sidedef sd in s.Sidedefs)
{
bool front, back;
if(sd.Line.Front != null) front = sd.Line.Front.Sector.Selected; else front = false;
if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false;
sd.Line.Selected = front | back;
}
}
}
else
{
// Remove from list
orderedselection.Remove(s);
}
}