diff -r e6b8dab8f81a -r c9f02d2dd9eb bbox.cpp --- a/bbox.cpp Mon Mar 25 17:04:18 2013 +0200 +++ b/bbox.cpp Mon Mar 25 22:52:53 2013 +0200 @@ -34,43 +34,60 @@ if (!g_CurrentFile) return; - for (LDObject* obj : g_CurrentFile->objects) { - switch (obj->getType ()) { - case OBJ_Line: - { - LDLine* line = static_cast (obj); - for (short i = 0; i < 2; ++i) - checkVertex (line->vaCoords[i]); - } - break; - - case OBJ_Triangle: - { - LDTriangle* tri = static_cast (obj); - for (short i = 0; i < 3; ++i) - checkVertex (tri->vaCoords[i]); + for (LDObject* obj : g_CurrentFile->objects) + checkObject (obj); +} + +// ============================================================================= +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// ============================================================================= +void bbox::checkObject (LDObject* obj) { + switch (obj->getType ()) { + case OBJ_Line: + { + LDLine* line = static_cast (obj); + for (short i = 0; i < 2; ++i) + checkVertex (line->vaCoords[i]); + } + break; + + case OBJ_Triangle: + { + LDTriangle* tri = static_cast (obj); + for (short i = 0; i < 3; ++i) + checkVertex (tri->vaCoords[i]); + } + break; + + case OBJ_Quad: + { + LDQuad* quad = static_cast (obj); + for (short i = 0; i < 4; ++i) + checkVertex (quad->vaCoords[i]); + } + break; + + case OBJ_CondLine: + { + LDCondLine* line = static_cast (obj); + for (short i = 0; i < 4; ++i) + checkVertex (line->vaCoords[i]); + } + break; + + case OBJ_Subfile: + { + LDSubfile* ref = static_cast (obj); + vector objs = ref->inlineContents (true, true); + + for (LDObject* obj : objs) { + checkObject (obj); + delete obj; } - break; - - case OBJ_Quad: - { - LDQuad* quad = static_cast (obj); - for (short i = 0; i < 4; ++i) - checkVertex (quad->vaCoords[i]); - } - break; - - case OBJ_CondLine: - { - LDCondLine* line = static_cast (obj); - for (short i = 0; i < 4; ++i) - checkVertex (line->vaCoords[i]); - } - break; - - default: - break; } + + default: + break; } }