fix, replace std::sort by std::stable_sort (#16092)

* fix, replace std::sort by std::stable_sort
This commit is contained in:
halx99 2016-07-12 13:46:38 +08:00 committed by minggo
parent 9f09349fa9
commit c0e0931838
2 changed files with 2 additions and 2 deletions

View File

@ -1140,7 +1140,7 @@ void Node::sortAllChildren()
{
if (_reorderChildDirty)
{
std::sort(std::begin(_children), std::end(_children), nodeComparisonLess);
std::stable_sort(std::begin(_children), std::end(_children), nodeComparisonLess);
_reorderChildDirty = false;
}
}

View File

@ -252,7 +252,7 @@ void ProtectedNode::insertProtectedChild(cocos2d::Node *child, int z)
void ProtectedNode::sortAllProtectedChildren()
{
if( _reorderProtectedChildDirty ) {
std::sort( std::begin(_protectedChildren), std::end(_protectedChildren), nodeComparisonLess );
std::stable_sort( std::begin(_protectedChildren), std::end(_protectedChildren), nodeComparisonLess );
_reorderProtectedChildDirty = false;
}
}