some optimizations

This commit is contained in:
codeimp 2008-04-19 15:44:05 +00:00
parent 53fd1fb04c
commit 40f5e853bd
5 changed files with 19 additions and 10 deletions

View file

@ -292,8 +292,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
if(MoveGeometryRelative(mousemappos - dragstartmappos, snaptogrid, snaptonearest))
{
// Update cached values
//General.Map.Map.Update(true, false);
General.Map.Map.Update();
General.Map.Map.Update(true, false);
// Redraw
General.Interface.RedrawDisplay();

View file

@ -27,6 +27,7 @@ using CodeImp.DoomBuilder.Rendering;
using SlimDX;
using System.Drawing;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.IO;
#endregion
@ -53,7 +54,10 @@ namespace CodeImp.DoomBuilder.Map
private LinkedList<Sidedef> sidedefs;
private LinkedList<Sector> sectors;
private LinkedList<Thing> things;
// Optimization
private long emptylongname;
// Disposing
private bool isdisposed = false;
@ -67,6 +71,7 @@ namespace CodeImp.DoomBuilder.Map
public ICollection<Sector> Sectors { get { return sectors; } }
public ICollection<Thing> Things { get { return things; } }
public bool IsDisposed { get { return isdisposed; } }
public long EmptyLongName { get { return emptylongname; } }
#endregion
@ -83,6 +88,7 @@ namespace CodeImp.DoomBuilder.Map
things = new LinkedList<Thing>();
indexholes = new List<int>();
lastsectorindex = 0;
emptylongname = Lump.MakeLongName("-");
// We have no destructor
GC.SuppressFinalize(this);

View file

@ -114,8 +114,10 @@ namespace CodeImp.DoomBuilder.Map
this.sidedefs = new LinkedList<Sidedef>();
this.things = new LinkedList<Thing>();
this.index = index;
SetCeilTexture("-");
SetFloorTexture("-");
this.floortexname = "-";
this.ceiltexname = "-";
this.longfloortexname = map.EmptyLongName;
this.longceiltexname = map.EmptyLongName;
// We have no destructor
GC.SuppressFinalize(this);

View file

@ -98,9 +98,12 @@ namespace CodeImp.DoomBuilder.Map
this.mainlistitem = listitem;
this.linedef = l;
this.sector = s;
SetTextureHigh("-");
SetTextureMid("-");
SetTextureLow("-");
this.texnamehigh = "-";
this.texnamemid = "-";
this.texnamelow = "-";
this.longtexnamehigh = map.EmptyLongName;
this.longtexnamemid = map.EmptyLongName;
this.longtexnamelow = map.EmptyLongName;
// Attach to the linedef
if(front) l.AttachFront(this); else l.AttachBack(this);

View file

@ -181,8 +181,7 @@ namespace CodeImp.DoomBuilder.Map
// This returns the distance from given coordinates
public float DistanceToSq(Vector2D p)
{
Vector2D delta = p - pos;
return delta.GetLengthSq();
return (p.x - pos.x) * (p.x - pos.x) + (p.y - pos.y) * (p.y - pos.y);
}
// This returns the distance from given coordinates