This commit is contained in:
JoelKatz
2012-02-07 17:02:59 -08:00
parent 704eb22195
commit 104fa67d86

View File

@@ -219,7 +219,7 @@ SHAMapItem::pointer SHAMap::onlyBelow(SHAMapTreeNode::pointer node)
found=false; found=false;
SHAMapTreeNode::pointer nextNode; SHAMapTreeNode::pointer nextNode;
for(int i=0; i<15; i++) for(int i=0; i<16; i++)
if(!node->isEmptyBranch(i)) if(!node->isEmptyBranch(i))
{ {
if(found) return SHAMapItem::pointer(); // two leaves below if(found) return SHAMapItem::pointer(); // two leaves below
@@ -230,6 +230,7 @@ SHAMapItem::pointer SHAMap::onlyBelow(SHAMapTreeNode::pointer node)
if(!found) if(!found)
{ {
std::cerr << node->getString() << std::endl;
assert(false); assert(false);
return SHAMapItem::pointer(); return SHAMapItem::pointer();
} }
@@ -242,7 +243,7 @@ SHAMapItem::pointer SHAMap::onlyBelow(SHAMapTreeNode::pointer node)
void SHAMap::eraseChildren(SHAMapTreeNode::pointer node) void SHAMap::eraseChildren(SHAMapTreeNode::pointer node)
{ // this node has only one item below it, erase its children { // this node has only one item below it, erase its children
bool erase=false; bool erase=false;
while(!node->isLeaf()) while(node->isInner())
{ {
for(int i=0; i<16; i++) for(int i=0; i<16; i++)
if(!node->isEmptyBranch(i)) if(!node->isEmptyBranch(i))
@@ -256,6 +257,7 @@ void SHAMap::eraseChildren(SHAMapTreeNode::pointer node)
} }
erase=true; erase=true;
node=nextNode; node=nextNode;
break;
} }
} }
returnNode(node, true); returnNode(node, true);