Quadtree addition to root node now functions (w/out Qt)
authorDavid Gow <[email protected]>
Mon, 6 Oct 2014 08:23:41 +0000 (16:23 +0800)
committerDavid Gow <[email protected]>
Mon, 6 Oct 2014 08:23:41 +0000 (16:23 +0800)
Apologies, etc.

src/document.cpp
src/main.h
src/view.cpp

index 6e022df..b347c76 100644 (file)
@@ -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)
index af7df43..5015044 100644 (file)
@@ -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)
index 5acd860..4df318b 100644 (file)
@@ -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");
        

UCC git Repository :: git.ucc.asn.au