@ Changed the MapSet to work with arrays instead of linkedlists. Because the index is now know for each element and can be retrieved in O(1) efficiency it has become a property (Index) for all map elements. GetIndexFor* functions have been removed. Get*ByIndex are now also of O(1) efficiency.

This commit is contained in:
codeimp 2009-06-05 19:03:56 +00:00
parent 45ad5f5943
commit f09bfff419
34 changed files with 461 additions and 408 deletions

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</ProjectGuid>
<OutputType>WinExe</OutputType>
@ -676,6 +676,7 @@
<Compile Include="General\ErrorLogger.cs" />
<Compile Include="IO\DoomColormapReader.cs" />
<Compile Include="Map\SelectionType.cs" />
<Compile Include="Map\MapElementCollection.cs" />
<Compile Include="Rendering\SurfaceBufferSet.cs" />
<Compile Include="Rendering\SurfaceEntry.cs" />
<Compile Include="Rendering\SurfaceManager.cs" />
@ -877,4 +878,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>

View file

@ -107,7 +107,7 @@ namespace CodeImp.DoomBuilder.Controls
peggedness = "None";
// Linedef info
infopanel.Text = " Linedef " + l.Map.GetIndexForLinedef(l) + " ";
infopanel.Text = " Linedef " + l.Index + " ";
action.Text = act.ToString();
length.Text = l.Length.ToString("0.##");
angle.Text = l.AngleDeg.ToString() + "\u00B0";
@ -145,7 +145,7 @@ namespace CodeImp.DoomBuilder.Controls
if(l.Front != null)
{
// Show sidedef info
frontpanel.Text = " Front Sidedef " + l.Map.GetIndexForSidedef(l.Front) + " ";
frontpanel.Text = " Front Sidedef " + l.Index + " ";
frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
fronthighname.Text = l.Front.HighTexture;
frontmidname.Text = l.Front.MiddleTexture;
@ -177,7 +177,7 @@ namespace CodeImp.DoomBuilder.Controls
if(l.Back != null)
{
// Show sidedef info
backpanel.Text = " Back Sidedef " + l.Map.GetIndexForSidedef(l.Back) + " ";
backpanel.Text = " Back Sidedef " + l.Index + " ";
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
backhighname.Text = l.Back.HighTexture;
backmidname.Text = l.Back.MiddleTexture;

View file

@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.Controls
effectinfo = s.Effect.ToString() + " - Unknown";
// Sector info
sectorinfo.Text = " Sector " + s.Map.GetIndexForSector(s) + " ";
sectorinfo.Text = " Sector " + s.Index + " ";
effect.Text = effectinfo;
ceiling.Text = s.CeilHeight.ToString();
floor.Text = s.FloorHeight.ToString();

View file

@ -139,7 +139,7 @@ namespace CodeImp.DoomBuilder.Controls
}
// Thing info
infopanel.Text = " Thing " + t.Map.GetIndexForThing(t) + " ";
infopanel.Text = " Thing " + t.Index + " ";
type.Text = t.Type + " - " + ti.Title;
action.Text = actioninfo;
position.Text = t.Position.x.ToString() + ", " + t.Position.y.ToString() + ", " + zinfo;

View file

@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Controls
public void ShowInfo(Vertex v)
{
// Vertex info
vertexinfo.Text = " Vertex " + v.Map.GetIndexForVertex(v) + " ";
vertexinfo.Text = " Vertex " + v.Index + " ";
position.Text = v.Position.x.ToString("0.##") + ", " + v.Position.y.ToString("0.##");
// Show the whole thing

View file

@ -344,6 +344,7 @@ namespace CodeImp.DoomBuilder
mapwad.Dispose();
// Read the map from temp file
map.BeginAddRemove();
General.WriteLogLine("Initializing map format interface " + config.FormatInterface + "...");
io = MapSetIO.Create(config.FormatInterface, tempwad, this);
General.WriteLogLine("Reading map data structures from file...");
@ -354,6 +355,7 @@ namespace CodeImp.DoomBuilder
General.ShowErrorMessage("Unable to read the map data structures with the specified configuration.", MessageBoxButtons.OK);
return false;
}
map.EndAddRemove();
// Load data manager
General.WriteLogLine("Loading data resources...");

View file

@ -923,8 +923,10 @@ namespace CodeImp.DoomBuilder.Geometry
}
// Join merge vertices so that overlapping vertices in the draw become one.
map.BeginAddRemove();
MapSet.JoinVertices(mergeverts, mergeverts, false, MapSet.STITCH_DISTANCE);
map.EndAddRemove();
/***************************************************\
Find a way to close the drawing
\***************************************************/
@ -1157,9 +1159,11 @@ namespace CodeImp.DoomBuilder.Geometry
// Merge intersetion vertices with the new lines. This completes the
// self intersections for which splits were made above.
map.Update(true, false);
map.BeginAddRemove();
MapSet.SplitLinesByVertices(newlines, intersectverts, MapSet.STITCH_DISTANCE, null);
MapSet.SplitLinesByVertices(newlines, mergeverts, MapSet.STITCH_DISTANCE, null);
map.EndAddRemove();
/***************************************************\
Determine drawing interior
\***************************************************/

View file

@ -129,6 +129,7 @@ namespace CodeImp.DoomBuilder.IO
reader = new BinaryReader(mem);
// Read items from the lump
map.SetCapacity(0, 0, 0, 0, num);
for(i = 0; i < num; i++)
{
// Read properties from stream
@ -178,6 +179,7 @@ namespace CodeImp.DoomBuilder.IO
link = new Dictionary<int, Vertex>(num);
// Read items from the lump
map.SetCapacity(num, 0, 0, 0, 0);
for(i = 0; i < num; i++)
{
// Read properties from stream
@ -222,6 +224,7 @@ namespace CodeImp.DoomBuilder.IO
link = new Dictionary<int, Sector>(num);
// Read items from the lump
map.SetCapacity(0, 0, 0, num, 0);
for(i = 0; i < num; i++)
{
// Read properties from stream
@ -255,7 +258,7 @@ namespace CodeImp.DoomBuilder.IO
MemoryStream linedefsmem, sidedefsmem;
BinaryReader readline, readside;
Lump linedefslump, sidedefslump;
int num, i, offsetx, offsety, v1, v2;
int num, numsides, i, offsetx, offsety, v1, v2;
int s1, s2, flags, action, tag, sc;
Dictionary<string, bool> stringflags;
string thigh, tmid, tlow;
@ -274,10 +277,12 @@ namespace CodeImp.DoomBuilder.IO
linedefsmem = new MemoryStream(linedefslump.Stream.ReadAllBytes());
sidedefsmem = new MemoryStream(sidedefslump.Stream.ReadAllBytes());
num = (int)linedefslump.Stream.Length / 14;
numsides = (int)sidedefslump.Stream.Length / 30;
readline = new BinaryReader(linedefsmem);
readside = new BinaryReader(sidedefsmem);
// Read items from the lump
map.SetCapacity(0, num, numsides, 0, 0);
for(i = 0; i < num; i++)
{
// Read properties from stream

View file

@ -131,6 +131,7 @@ namespace CodeImp.DoomBuilder.IO
reader = new BinaryReader(mem);
// Read items from the lump
map.SetCapacity(0, 0, 0, 0, num);
for(i = 0; i < num; i++)
{
// Read properties from stream
@ -188,6 +189,7 @@ namespace CodeImp.DoomBuilder.IO
link = new Dictionary<int, Vertex>(num);
// Read items from the lump
map.SetCapacity(num, 0, 0, 0, 0);
for(i = 0; i < num; i++)
{
// Read properties from stream
@ -232,6 +234,7 @@ namespace CodeImp.DoomBuilder.IO
link = new Dictionary<int, Sector>(num);
// Read items from the lump
map.SetCapacity(0, 0, 0, num, 0);
for(i = 0; i < num; i++)
{
// Read properties from stream
@ -265,7 +268,7 @@ namespace CodeImp.DoomBuilder.IO
MemoryStream linedefsmem, sidedefsmem;
BinaryReader readline, readside;
Lump linedefslump, sidedefslump;
int num, i, offsetx, offsety, v1, v2;
int num, numsides, i, offsetx, offsety, v1, v2;
int s1, s2, flags, action, sc;
int[] args = new int[Linedef.NUM_ARGS];
Dictionary<string, bool> stringflags;
@ -285,10 +288,12 @@ namespace CodeImp.DoomBuilder.IO
linedefsmem = new MemoryStream(linedefslump.Stream.ReadAllBytes());
sidedefsmem = new MemoryStream(sidedefslump.Stream.ReadAllBytes());
num = (int)linedefslump.Stream.Length / 16;
numsides = (int)sidedefslump.Stream.Length / 30;
readline = new BinaryReader(linedefsmem);
readside = new BinaryReader(sidedefsmem);
// Read items from the lump
map.SetCapacity(0, num, numsides, 0, 0);
for(i = 0; i < num; i++)
{
// Read properties from stream

View file

@ -150,6 +150,7 @@ namespace CodeImp.DoomBuilder.IO
List<UniversalCollection> collections = GetNamedCollections(textmap.Root, "thing");
// Go for all collections
map.SetCapacity(0, 0, 0, 0, collections.Count);
for(int i = 0; i < collections.Count; i++)
{
// Read fields
@ -196,6 +197,7 @@ namespace CodeImp.DoomBuilder.IO
List<UniversalCollection> sidescolls = GetNamedCollections(textmap.Root, "sidedef");
// Go for all lines
map.SetCapacity(0, linescolls.Count, sidescolls.Count, 0, 0);
for(int i = 0; i < linescolls.Count; i++)
{
// Read fields
@ -308,6 +310,7 @@ namespace CodeImp.DoomBuilder.IO
link = new Dictionary<int, Sector>(collections.Count);
// Go for all collections
map.SetCapacity(0, 0, 0, collections.Count, 0);
for(int i = 0; i < collections.Count; i++)
{
// Read fields
@ -347,6 +350,7 @@ namespace CodeImp.DoomBuilder.IO
link = new Dictionary<int, Vertex>(collections.Count);
// Go for all collections
map.SetCapacity(collections.Count, 0, 0, 0, 0);
for(int i = 0; i < collections.Count; i++)
{
// Read fields

View file

@ -47,7 +47,6 @@ namespace CodeImp.DoomBuilder.Map
private MapSet map;
// List items
private LinkedListNode<Linedef> mainlistitem;
private LinkedListNode<Linedef> startvertexlistitem;
private LinkedListNode<Linedef> endvertexlistitem;
private LinkedListNode<Linedef> selecteditem;
@ -109,11 +108,11 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
internal Linedef(MapSet map, LinkedListNode<Linedef> listitem, Vertex start, Vertex end)
internal Linedef(MapSet map, int listindex, Vertex start, Vertex end)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.start = start;
this.end = end;
this.updateneeded = true;
@ -129,11 +128,11 @@ namespace CodeImp.DoomBuilder.Map
}
// Constructor
internal Linedef(MapSet map, LinkedListNode<Linedef> listitem, Vertex start, Vertex end, IReadWriteStream stream)
internal Linedef(MapSet map, int listindex, Vertex start, Vertex end, IReadWriteStream stream)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.start = start;
this.end = end;
this.updateneeded = true;
@ -159,7 +158,7 @@ namespace CodeImp.DoomBuilder.Map
isdisposed = true;
// Remove from main list
mainlistitem.List.Remove(mainlistitem);
map.RemoveLinedef(listindex);
// Detach from vertices
start.DetachLinedef(startvertexlistitem);
@ -172,7 +171,6 @@ namespace CodeImp.DoomBuilder.Map
if(back != null) back.Dispose();
// Clean up
mainlistitem = null;
start = null;
end = null;
front = null;
@ -222,14 +220,6 @@ namespace CodeImp.DoomBuilder.Map
for(int i = 0; i < NUM_ARGS; i++) s.rwInt(ref args[i]);
}
/// <summary>
/// Returns the index of this linedef. This is a O(n) operation.
/// </summary>
public int GetIndex()
{
return map.GetIndexForLinedef(this);
}
// This sets new start vertex
public void SetStartVertex(Vertex v)
{
@ -941,7 +931,7 @@ namespace CodeImp.DoomBuilder.Map
// String representation
public override string ToString()
{
return "Linedef " + GetIndex();
return "Linedef " + listindex;
}
#endregion

View file

@ -38,7 +38,10 @@ namespace CodeImp.DoomBuilder.Map
#endregion
#region ================== Variables
// List index
protected int listindex;
// Univeral fields
private UniFields fields;
@ -51,7 +54,8 @@ namespace CodeImp.DoomBuilder.Map
#endregion
#region ================== Properties
public int Index { get { return listindex; } internal set { listindex = value; } }
public UniFields Fields { get { return fields; } }
public bool Marked { get { return marked; } set { marked = value; } }
public bool IsDisposed { get { return isdisposed; } }

View file

@ -0,0 +1,82 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Drawing;
using SlimDX.Direct3D9;
using SlimDX;
using System.Collections;
using System.Collections.Generic;
#endregion
namespace CodeImp.DoomBuilder.Map
{
public sealed class MapElementCollection<T> : ICollection<T> where T: MapElement
{
// Members
private int numitems;
private T[] array;
// Constructor
public MapElementCollection(ref T[] array, int numitems)
{
this.numitems = numitems;
this.array = array;
}
public void Add(T item)
{
throw new NotSupportedException();
}
public void Clear()
{
throw new NotSupportedException();
}
public bool Contains(T item)
{
throw new NotSupportedException();
}
public void CopyTo(T[] array, int arrayIndex)
{
this.array.CopyTo(array, arrayIndex);
}
public int Count { get { return numitems; } }
public bool IsReadOnly { get { return true; } }
public bool Remove(T item)
{
throw new NotSupportedException();
}
public IEnumerator<T> GetEnumerator()
{
throw new NotSupportedException("This array is locked for modification and cannot currently be enumerated.");
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotSupportedException("This array is locked for modification and cannot currently be enumerated.");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -45,7 +45,6 @@ namespace CodeImp.DoomBuilder.Map
private MapSet map;
// List items
private LinkedListNode<Sector> mainlistitem;
private LinkedListNode<Sector> selecteditem;
// Sidedefs
@ -109,11 +108,11 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
internal Sector(MapSet map, LinkedListNode<Sector> listitem, int index)
internal Sector(MapSet map, int listindex, int index)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.sidedefs = new LinkedList<Sidedef>();
this.fixedindex = index;
this.floortexname = "-";
@ -121,19 +120,21 @@ namespace CodeImp.DoomBuilder.Map
this.longfloortexname = MapSet.EmptyLongName;
this.longceiltexname = MapSet.EmptyLongName;
this.triangulationneeded = true;
this.surfaceentry = new SurfaceEntry(-1, -1, -1);
// We have no destructor
GC.SuppressFinalize(this);
}
// Constructor
internal Sector(MapSet map, LinkedListNode<Sector> listitem, IReadWriteStream stream)
internal Sector(MapSet map, int listindex, IReadWriteStream stream)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.sidedefs = new LinkedList<Sidedef>();
this.triangulationneeded = true;
this.surfaceentry = new SurfaceEntry(-1, -1, -1);
ReadWrite(stream);
@ -151,7 +152,7 @@ namespace CodeImp.DoomBuilder.Map
isdisposed = true;
// Remove from main list
mainlistitem.List.Remove(mainlistitem);
map.RemoveSector(listindex);
// Register the index as free
map.AddSectorIndexHole(fixedindex);
@ -164,7 +165,6 @@ namespace CodeImp.DoomBuilder.Map
General.Map.CRenderer2D.Surfaces.FreeSurfaces(surfaceentry);
// Clean up
mainlistitem = null;
sidedefs = null;
map = null;
@ -250,14 +250,6 @@ namespace CodeImp.DoomBuilder.Map
base.CopyPropertiesTo(s);
}
/// <summary>
/// Returns the index of this sector. This is a O(n) operation.
/// </summary>
public int GetIndex()
{
return map.GetIndexForSector(this);
}
// This attaches a sidedef and returns the listitem
public LinkedListNode<Sidedef> AttachSidedef(Sidedef sd)
{
@ -506,7 +498,7 @@ namespace CodeImp.DoomBuilder.Map
// String representation
public override string ToString()
{
return "Sector " + GetIndex();
return "Sector " + listindex;
}
#endregion

View file

@ -41,7 +41,6 @@ namespace CodeImp.DoomBuilder.Map
private MapSet map;
// List items
private LinkedListNode<Sidedef> mainlistitem;
private LinkedListNode<Sidedef> sectorlistitem;
// Owner
@ -88,11 +87,11 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
internal Sidedef(MapSet map, LinkedListNode<Sidedef> listitem, Linedef l, bool front, Sector s)
internal Sidedef(MapSet map, int listindex, Linedef l, bool front, Sector s)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.linedef = l;
this.sector = s;
this.texnamehigh = "-";
@ -113,11 +112,11 @@ namespace CodeImp.DoomBuilder.Map
}
// Constructor
internal Sidedef(MapSet map, LinkedListNode<Sidedef> listitem, Linedef l, bool front, Sector s, IReadWriteStream stream)
internal Sidedef(MapSet map, int listindex, Linedef l, bool front, Sector s, IReadWriteStream stream)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.linedef = l;
this.sector = s;
@ -143,7 +142,7 @@ namespace CodeImp.DoomBuilder.Map
isdisposed = true;
// Remove from main list
mainlistitem.List.Remove(mainlistitem);
map.RemoveSidedef(listindex);
// Detach from linedef
linedef.DetachSidedef(this);
@ -152,7 +151,6 @@ namespace CodeImp.DoomBuilder.Map
sector.DetachSidedef(sectorlistitem);
// Clean up
mainlistitem = null;
sectorlistitem = null;
linedef = null;
map = null;
@ -203,14 +201,6 @@ namespace CodeImp.DoomBuilder.Map
base.CopyPropertiesTo(s);
}
/// <summary>
/// Returns the index of this sidedef. This is a O(n) operation.
/// </summary>
public int GetIndex()
{
return map.GetIndexForSidedef(this);
}
// This creates a checksum from the sidedef properties
// Used for faster sidedefs compression
public uint GetChecksum()

View file

@ -49,7 +49,6 @@ namespace CodeImp.DoomBuilder.Map
private Sector sector = null;
// List items
private LinkedListNode<Thing> mainlistitem;
private LinkedListNode<Thing> selecteditem;
// Properties
@ -91,11 +90,11 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
internal Thing(MapSet map, LinkedListNode<Thing> listitem)
internal Thing(MapSet map, int listindex)
{
// Initialize
this.map = map;
this.mainlistitem = listitem;
this.listindex = listindex;
this.flags = new Dictionary<string, bool>();
this.args = new int[NUM_ARGS];
@ -113,13 +112,12 @@ namespace CodeImp.DoomBuilder.Map
isdisposed = true;
// Remove from main list
mainlistitem.List.Remove(mainlistitem);
map.RemoveThing(listindex);
// Remove from sector
//if(sector != null) sector.DetachThing(sectorlistitem);
// Clean up
mainlistitem = null;
map = null;
sector = null;
@ -186,14 +184,6 @@ namespace CodeImp.DoomBuilder.Map
base.CopyPropertiesTo(t);
}
/// <summary>
/// Returns the index of the specified thing. This is a O(n) operation.
/// </summary>
public int GetIndex()
{
return map.GetIndexForThing(this);
}
// This determines which sector the thing is in and links it
public void DetermineSector()
{

View file

@ -46,7 +46,6 @@ namespace CodeImp.DoomBuilder.Map
private MapSet map;
// List items
private LinkedListNode<Vertex> mainlistitem;
private LinkedListNode<Vertex> selecteditem;
// Position
@ -74,12 +73,12 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Constructor / Disposer
// Constructor
internal Vertex(MapSet map, LinkedListNode<Vertex> listitem, Vector2D pos)
internal Vertex(MapSet map, int listindex, Vector2D pos)
{
// Initialize
this.map = map;
this.linedefs = new LinkedList<Linedef>();
this.mainlistitem = listitem;
this.listindex = listindex;
this.pos = pos;
// We have no destructor
@ -87,12 +86,12 @@ namespace CodeImp.DoomBuilder.Map
}
// Constructor
internal Vertex(MapSet map, LinkedListNode<Vertex> listitem, IReadWriteStream stream)
internal Vertex(MapSet map, int listindex, IReadWriteStream stream)
{
// Initialize
this.map = map;
this.linedefs = new LinkedList<Linedef>();
this.mainlistitem = listitem;
this.listindex = listindex;
ReadWrite(stream);
@ -110,7 +109,7 @@ namespace CodeImp.DoomBuilder.Map
isdisposed = true;
// Remove from main list
mainlistitem.List.Remove(mainlistitem);
map.RemoveVertex(listindex);
// Dispose the lines that are attached to this vertex
// because a linedef cannot exist without 2 vertices.
@ -118,7 +117,6 @@ namespace CodeImp.DoomBuilder.Map
// Clean up
linedefs = null;
mainlistitem = null;
map = null;
// Dispose base
@ -178,14 +176,6 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Methods
/// <summary>
/// Returns the index of this vertex. This is a O(n) operation.
/// </summary>
public int GetIndex()
{
return map.GetIndexForVertex(this);
}
// This copies all properties to another thing
public void CopyPropertiesTo(Vertex v)
{

View file

@ -167,7 +167,7 @@ namespace CodeImp.DoomBuilder.Windows
fronthigh.Required = fl.Front.HighRequired();
frontmid.Required = fl.Front.MiddleRequired();
frontlow.Required = fl.Front.LowRequired();
frontsector.Text = fl.Map.GetIndexForSector(fl.Front.Sector).ToString();
frontsector.Text = fl.Front.Sector.Index.ToString();
frontoffsetx.Text = fl.Front.OffsetX.ToString();
frontoffsety.Text = fl.Front.OffsetY.ToString();
}
@ -181,7 +181,7 @@ namespace CodeImp.DoomBuilder.Windows
backhigh.Required = fl.Back.HighRequired();
backmid.Required = fl.Back.MiddleRequired();
backlow.Required = fl.Back.LowRequired();
backsector.Text = fl.Map.GetIndexForSector(fl.Back.Sector).ToString();
backsector.Text = fl.Back.Sector.Index.ToString();
backoffsetx.Text = fl.Back.OffsetX.ToString();
backoffsety.Text = fl.Back.OffsetY.ToString();
}
@ -266,7 +266,7 @@ namespace CodeImp.DoomBuilder.Windows
if(fronthigh.Required != l.Front.HighRequired()) fronthigh.Required = false;
if(frontmid.Required != l.Front.MiddleRequired()) frontmid.Required = false;
if(frontlow.Required != l.Front.LowRequired()) frontlow.Required = false;
if(frontsector.Text != l.Map.GetIndexForSector(l.Front.Sector).ToString()) frontsector.Text = "";
if(frontsector.Text != l.Front.Sector.Index.ToString()) frontsector.Text = "";
if(frontoffsetx.Text != l.Front.OffsetX.ToString()) frontoffsetx.Text = "";
if(frontoffsety.Text != l.Front.OffsetY.ToString()) frontoffsety.Text = "";
}
@ -280,7 +280,7 @@ namespace CodeImp.DoomBuilder.Windows
if(backhigh.Required != l.Back.HighRequired()) backhigh.Required = false;
if(backmid.Required != l.Back.MiddleRequired()) backmid.Required = false;
if(backlow.Required != l.Back.LowRequired()) backlow.Required = false;
if(backsector.Text != l.Map.GetIndexForSector(l.Back.Sector).ToString()) backsector.Text = "";
if(backsector.Text != l.Back.Sector.Index.ToString()) backsector.Text = "";
if(backoffsetx.Text != l.Back.OffsetX.ToString()) backoffsetx.Text = "";
if(backoffsety.Text != l.Back.OffsetY.ToString()) backoffsety.Text = "";
if(General.Map.FormatInterface.HasCustomFields) custombackbutton.Visible = true;
@ -407,7 +407,7 @@ namespace CodeImp.DoomBuilder.Windows
else if(frontside.CheckState == CheckState.Checked)
{
// Make sure we have a valid sector (make a new one if needed)
if(l.Front != null) index = l.Map.GetIndexForSector(l.Front.Sector); else index = -1;
if(l.Front != null) index = l.Front.Sector.Index; else index = -1;
s = General.Map.Map.GetSectorByIndex(frontsector.GetResult(index));
if(s == null) s = General.Map.Map.CreateSector();
@ -434,7 +434,7 @@ namespace CodeImp.DoomBuilder.Windows
else if(backside.CheckState == CheckState.Checked)
{
// Make sure we have a valid sector (make a new one if needed)
if(l.Back != null) index = l.Map.GetIndexForSector(l.Back.Sector); else index = -1;
if(l.Back != null) index = l.Back.Sector.Index; else index = -1;
s = General.Map.Map.GetSectorByIndex(backsector.GetResult(index));
if(s == null) s = General.Map.Map.CreateSector();

View file

@ -63,7 +63,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.viewobjects.Add(s);
foreach(Vertex vv in v) this.viewobjects.Add(vv);
this.description = "This sector is not a closed region and could cause problems with clipping and rendering in the game. The 'leaks' in the sector are indicated by the colored vertices.";
this.index = s.Map.GetIndexForSector(s);
this.index = s.Index;
}
#endregion

View file

@ -119,14 +119,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Replace and add to list
if(replacewith != null) s.SetCeilTexture(replacewith);
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex() + " (ceiling)"));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (ceiling)"));
}
if(s.LongFloorTexture == longfind)
{
// Replace and add to list
if(replacewith != null) s.SetFloorTexture(replacewith);
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex() + " (floor)"));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (floor)"));
}
}
@ -139,21 +139,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Replace and add to list
if(replacewith != null) sd.SetTextureHigh(replacewith);
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.GetIndex() + " (" + side + ", high)"));
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.Index + " (" + side + ", high)"));
}
if(sd.LongMiddleTexture == longfind)
{
// Replace and add to list
if(replacewith != null) sd.SetTextureMid(replacewith);
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.GetIndex() + " (" + side + ", middle)"));
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.Index + " (" + side + ", middle)"));
}
if(sd.LongLowTexture == longfind)
{
// Replace and add to list
if(replacewith != null) sd.SetTextureLow(replacewith);
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.GetIndex() + " (" + side + ", low)"));
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.Index + " (" + side + ", low)"));
}
}

View file

@ -142,9 +142,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Add to list
if(!info.IsNull)
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex() + " (" + info.Title + ")"));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (" + info.Title + ")"));
else
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex()));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index));
}
}
}

View file

@ -125,9 +125,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(l.Action);
if(!info.IsNull)
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex() + " (" + info.Title + ")"));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (" + info.Title + ")"));
else
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex()));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index));
}
}
}

View file

@ -142,9 +142,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Add to list
if(!info.IsNull)
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex() + " (" + info.Title + ")"));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (" + info.Title + ")"));
else
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex()));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index));
}
}
}

View file

@ -120,9 +120,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(l.Action);
if(!info.IsNull)
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex() + " (" + info.Title + ")"));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (" + info.Title + ")"));
else
objs.Add(new FindReplaceObject(l, "Linedef " + l.GetIndex()));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index));
}
}
}

View file

@ -120,9 +120,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
SectorEffectInfo info = General.Map.Config.GetSectorEffectInfo(s.Effect);
if(!info.IsNull)
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex() + " (" + info.Title + ")"));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (" + info.Title + ")"));
else
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex()));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index));
}
}
}

View file

@ -111,14 +111,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Replace and add to list
if(replacewith != null) s.SetCeilTexture(replacewith);
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex() + " (ceiling)"));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (ceiling)"));
}
if(s.LongFloorTexture == longfind)
{
// Replace and add to list
if(replacewith != null) s.SetFloorTexture(replacewith);
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex() + " (floor)"));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (floor)"));
}
}

View file

@ -117,9 +117,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
SectorEffectInfo info = General.Map.Config.GetSectorEffectInfo(s.Effect);
if(!info.IsNull)
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex() + " (" + info.Title + ")"));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (" + info.Title + ")"));
else
objs.Add(new FindReplaceObject(s, "Sector " + s.GetIndex()));
objs.Add(new FindReplaceObject(s, "Sector " + s.Index));
}
}
}

View file

@ -112,21 +112,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Replace and add to list
if(replacewith != null) sd.SetTextureHigh(replacewith);
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.GetIndex() + " (" + side + ", high)"));
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.Index + " (" + side + ", high)"));
}
if(sd.LongMiddleTexture == longfind)
{
// Replace and add to list
if(replacewith != null) sd.SetTextureMid(replacewith);
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.GetIndex() + " (" + side + ", middle)"));
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.Index + " (" + side + ", middle)"));
}
if(sd.LongLowTexture == longfind)
{
// Replace and add to list
if(replacewith != null) sd.SetTextureLow(replacewith);
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.GetIndex() + " (" + side + ", low)"));
objs.Add(new FindReplaceObject(sd, "Sidedef " + sd.Index + " (" + side + ", low)"));
}
}

View file

@ -127,7 +127,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.GetIndex() + " (" + ti.Title + ")"));
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")"));
}
}
}

View file

@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.GetIndex() + " (" + ti.Title + ")"));
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")"));
}
}
}

View file

@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.GetIndex() + " (" + ti.Title + ")"));
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")"));
}
}
}

View file

@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.GetIndex() + " (" + ti.Title + ")"));
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")"));
}
}
}

View file

@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.GetIndex() + " (" + ti.Title + ")"));
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")"));
}
}
}