Permalink
Browse files

Merge pull request #472 from minggo/iss680

fixed #680
  • Loading branch information...
2 parents f685eb9 + 32ce6a5 commit 33025aa1bad35aa5dc0d7ef26c383bad6f2af7eb @walzer walzer committed Aug 17, 2011
Showing with 17 additions and 1 deletion.
  1. +16 −0 cocos2dx/include/CCMutableArray.h
  2. +1 −1 cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp
@@ -325,6 +325,22 @@ class CCMutableArray : public CCObject
return m_array.rbegin();
}
+ CCMutableArrayIterator getLastValidIterator(void)
+ {
+ CCMutableArrayIterator iter;
+ CCMutableArrayIterator ret;
+ for (iter = m_array.begin(); iter != m_array.end(); ++iter)
+ {
+ ret = iter;
+ if (! (*iter))
+ {
+ break;
+ }
+ }
+
+ return ret;
+ }
+
/*
* end is a keyword of lua, so should use other name
* to export to lua
@@ -264,7 +264,7 @@ CCTouchHandler* CCTouchDispatcher::findHandler(CCTouchDelegate *pDelegate)
void CCTouchDispatcher::rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArray)
{
- std::sort(pArray->begin(), pArray->end(), less);
+ std::sort(pArray->begin(), pArray->getLastValidIterator(), less);
}
void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)

0 comments on commit 33025aa

Please sign in to comment.