// This sets new start vertex public void SetStartVertex(Vertex v) { if (map == General.Map.Map) { General.Map.UndoRedo.RecRefLinedefStart(this); } // Change start if (startvertexlistitem != null) { start.DetachLinedefP(startvertexlistitem); } startvertexlistitem = null; start = v; if (start != null) { startvertexlistitem = start.AttachLinedefP(this); } this.updateneeded = true; }
// This sets new end vertex public void SetEndVertex(Vertex v) { if (map == General.Map.Map) { General.Map.UndoRedo.RecRefLinedefEnd(this); } // Change end if (endvertexlistitem != null) { end.DetachLinedefP(endvertexlistitem); } endvertexlistitem = null; end = v; if (end != null) { endvertexlistitem = end.AttachLinedefP(this); } this.updateneeded = true; }
// Constructor internal Linedef(MapSet map, int listindex, Vertex start, Vertex end) { // Initialize this.map = map; this.listindex = listindex; this.updateneeded = true; this.args = new int[NUM_ARGS]; this.flags = new Dictionary <string, bool>(); // Attach to vertices this.start = start; this.startvertexlistitem = start.AttachLinedefP(this); this.end = end; this.endvertexlistitem = end.AttachLinedefP(this); if (map == General.Map.Map) { General.Map.UndoRedo.RecAddLinedef(this); } // We have no destructor GC.SuppressFinalize(this); }