fixed left-over geometry when canceling a paste operation

This commit is contained in:
codeimp 2009-01-12 21:20:12 +00:00
parent 1d38b2b7e1
commit 69f608ddbc
3 changed files with 29 additions and 14 deletions

View file

@ -92,7 +92,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
(General.Map.Map.GetMarkedThings(true).Count > 0);
}
// This is called when something is pasted.
// This is called when something was pasted.
public override void OnPasteEnd()
{
General.Map.Map.ClearAllSelected();

View file

@ -723,16 +723,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnCancel();
// Reset geometry in original position
int index = 0;
foreach(Vertex v in selectedvertices)
v.Move(vertexpos[index++]);
index = 0;
foreach(Thing t in selectedthings)
// Paste operation?
if(pasting)
{
t.Rotate(thingangle[index]);
t.Move(thingpos[index++]);
// Remove the geometry
int index = 0;
foreach(Vertex v in selectedvertices)
v.Dispose();
index = 0;
foreach(Thing t in selectedthings)
t.Dispose();
}
else
{
// Reset geometry in original position
int index = 0;
foreach(Vertex v in selectedvertices)
v.Move(vertexpos[index++]);
index = 0;
foreach(Thing t in selectedthings)
{
t.Rotate(thingangle[index]);
t.Move(thingpos[index++]);
}
}
General.Map.Map.Update(true, true);

View file

@ -115,7 +115,7 @@ namespace CodeImp.DoomBuilder.IO
UniversalParser textmap = new UniversalParser();
textmap.StrictChecking = strictchecking;
try
//try
{
// Read UDMF from stream
textmap.InputConfiguration(reader.ReadToEnd());
@ -135,9 +135,9 @@ namespace CodeImp.DoomBuilder.IO
ReadThings(map, textmap);
}
}
catch(Exception e)
//catch(Exception e)
{
General.ShowErrorMessage("Unexpected error reading UDMF map data. " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK);
//General.ShowErrorMessage("Unexpected error reading UDMF map data. " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK);
}
return map;
@ -384,7 +384,7 @@ namespace CodeImp.DoomBuilder.IO
type = General.Map.Options.GetUniversalFieldType(elementname, e.Key, type);
// Make custom field
element.Fields.Add(e.Key, new UniValue(type, e.Value));
element.Fields[e.Key] = new UniValue(type, e.Value);
}
}
}