Skip to content

Commit

Permalink
Refactor|libdeng2: PathTree always maintains local branch hashes
Browse files Browse the repository at this point in the history
There is actually no need to optionally allow disabling the local
branch hashes.
  • Loading branch information
skyjake committed Nov 26, 2012
1 parent a5d6a05 commit 01364ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
3 changes: 1 addition & 2 deletions doomsday/libdeng2/include/de/data/pathtree.h
Expand Up @@ -80,8 +80,7 @@ class DENG2_PUBLIC PathTree
*/
enum Flag
{
MultiLeaf = 0x1, ///< There can be more than one leaf with a given name.
NoLocalBranchIndex = 0x2 ///< Branch nodes will not have an index of their immediate child nodes.
MultiLeaf = 0x1 ///< There can be more than one leaf with a given name.
};
Q_DECLARE_FLAGS(Flags, Flag)

Expand Down
3 changes: 1 addition & 2 deletions doomsday/libdeng2/src/data/pathtree.cpp
Expand Up @@ -367,8 +367,7 @@ static int iteratePathsInHash(PathTree const &pathTree, Path::hash_type hashKey,

// If the parent is known, we can narrow our search to all the parent's
// children.
if(!pathTree.flags().testFlag(PathTree::NoLocalBranchIndex) &&
flags.testFlag(PathTree::MatchParent) && parent)
if(flags.testFlag(PathTree::MatchParent) && parent)
{
nodes = &parent->childNodes(type);
}
Expand Down
14 changes: 4 additions & 10 deletions doomsday/libdeng2/src/data/pathtreenode.cpp
Expand Up @@ -109,22 +109,16 @@ PathTree::SegmentId PathTree::Node::segmentId() const

void PathTree::Node::addChild(PathTree::Node &node)
{
if(!d->tree.flags().testFlag(PathTree::NoLocalBranchIndex))
{
DENG2_ASSERT(d->children != 0);
DENG2_ASSERT(d->children != 0);

childNodes(node.type()).insert(node.hash(), &node);
}
childNodes(node.type()).insert(node.hash(), &node);
}

void PathTree::Node::removeChild(PathTree::Node &node)
{
if(!d->tree.flags().testFlag(PathTree::NoLocalBranchIndex))
{
DENG2_ASSERT(d->children != 0);
DENG2_ASSERT(d->children != 0);

childNodes(node.type()).remove(node.hash(), &node);
}
childNodes(node.type()).remove(node.hash(), &node);
}

String const &PathTree::Node::name() const
Expand Down

0 comments on commit 01364ef

Please sign in to comment.