From: David Gow Date: Mon, 6 Oct 2014 08:23:41 +0000 (+0800) Subject: Quadtree addition to root node now functions (w/out Qt) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a9883b166454c794e342ccc262ca97e0394af980;p=ipdf%2Fcode.git Quadtree addition to root node now functions (w/out Qt) Apologies, etc. --- diff --git a/src/document.cpp b/src/document.cpp index 6e022df..b347c76 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -225,16 +225,16 @@ void Document::OverlayQuadChildren(QuadTreeIndex orig_parent, QuadTreeIndex pare switch (type) { case QTC_TOP_LEFT: - orig_node = m_quadtree.nodes[orig_parent].top_left = new_index; + orig_node = m_quadtree.nodes[orig_parent].top_left; break; case QTC_TOP_RIGHT: - orig_node = m_quadtree.nodes[orig_parent].top_right = new_index; + orig_node = m_quadtree.nodes[orig_parent].top_right; break; case QTC_BOTTOM_LEFT: - orig_node = m_quadtree.nodes[orig_parent].bottom_left = new_index; + orig_node = m_quadtree.nodes[orig_parent].bottom_left; break; case QTC_BOTTOM_RIGHT: - orig_node = m_quadtree.nodes[orig_parent].bottom_right = new_index; + orig_node = m_quadtree.nodes[orig_parent].bottom_right; break; default: Fatal("Tried to overlay a QuadTree child of invalid type!"); @@ -244,7 +244,8 @@ void Document::OverlayQuadChildren(QuadTreeIndex orig_parent, QuadTreeIndex pare // Add us to the node's overlay linked list. QuadTreeIndex prev_overlay = orig_node; - while (m_quadtree.nodes[prev_overlay].next_overlay != -1); + while (m_quadtree.nodes[prev_overlay].next_overlay != -1) prev_overlay = m_quadtree.nodes[prev_overlay].next_overlay; + Debug("- Original node %d, Previous overlay %d, new overlay %d", orig_node, prev_overlay, new_index); m_quadtree.nodes[prev_overlay].next_overlay = new_index; // Recurse into any extant children. @@ -258,6 +259,7 @@ void Document::OverlayQuadChildren(QuadTreeIndex orig_parent, QuadTreeIndex pare OverlayQuadChildren(orig_node, new_index, QTC_BOTTOM_RIGHT); m_quadtree.nodes[new_index].object_dirty = m_quadtree.nodes[new_index].object_end; + m_quadtree.nodes[new_index].next_overlay = -1; } void Document::PropagateQuadChanges(QuadTreeIndex node) diff --git a/src/main.h b/src/main.h index af7df43..5015044 100644 --- a/src/main.h +++ b/src/main.h @@ -79,7 +79,7 @@ void MainLoop(Document & doc, Screen & scr, View & view, int max_frames = -1) // order is important... segfaults occur when screen (which inits GL) is not constructed first -_- DebugScript script; - scr.DebugFontInit("fonts/DejaVuSansMono.ttf", 32); + scr.DebugFontInit("fonts/DejaVuSansMono.ttf", 12); scr.SetMouseHandler(RatCatcher); if (script_filename) diff --git a/src/view.cpp b/src/view.cpp index 5acd860..4df318b 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -377,7 +377,8 @@ void View::Render(int width, int height) glPopDebugGroup(); #ifndef CONTROLPANEL_DISABLED - ControlPanel::Update(); + // The powers that be suggest that this may be causing of the segfaults. + //ControlPanel::Update(); #endif //CONTROLPANEL_DISABLED //Debug("Completed Render");