--- a/src/ldtypes.cpp Fri May 17 11:53:28 2013 +0300 +++ b/src/ldtypes.cpp Sat May 18 21:35:55 2013 +0300 @@ -182,10 +182,13 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void LDObject::replace (LDObject* replacement) { - // Replace all instances of the old object with the new object - for (LDObject*& obj : g_curfile->m_objs) - if (obj == this) + // Replace the instance of the old object with the new object + for (LDObject*& obj : g_curfile->m_objs) { + if (obj == this) { obj = replacement; + break; + } + } // Remove the old object delete this; @@ -793,4 +796,14 @@ return invertLine (this); } -HistoryEntry* LDVertex::invert () { return null; } \ No newline at end of file +HistoryEntry* LDVertex::invert () { return null; } + +// ============================================================================= +LDLine* LDCondLine::demote () { + LDLine* repl = new LDLine; + memcpy (repl->coords, coords, sizeof coords); + repl->color = color; + + replace (repl); + return repl; +} \ No newline at end of file