Merge branch 'develop' into dictionary_array_fixes

Conflicts:
	cocos2dx/platform/mac/CCFileUtilsMac.mm
	extensions/CCBReader/CCBAnimationManager.cpp
	extensions/CCBReader/CCBReader.cpp
	extensions/CCBReader/CCBSequenceProperty.cpp
	extensions/GUI/CCScrollView/CCScrollView.cpp
This commit is contained in:
Ricardo Quesada 2013-08-21 20:27:19 -07:00
commit a3eb0a058e
10 changed files with 54 additions and 39 deletions

View File

@ -177,6 +177,7 @@ public:
{
_state = SAX_ARRAY;
_array = new Array();
_array->init();
if (_resultType == SAX_RESULT_ARRAY && _rootArray == NULL)
{
_rootArray = _array;

View File

@ -356,15 +356,18 @@ Array* FileUtilsIOS::createArrayWithContentsOfFile(const std::string& filename)
// pPath = [[NSBundle mainBundle] pathForResource:pPath ofType:pathExtension];
// fixing cannot read data using Array::createWithContentsOfFile
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filename.c_str());
NSString* pPath = [NSString stringWithUTF8String:fullPath.c_str()];
NSArray* pArray = [NSArray arrayWithContentsOfFile:pPath];
NSString* path = [NSString stringWithUTF8String:fullPath.c_str()];
NSArray* array = [NSArray arrayWithContentsOfFile:path];
Array* pRet = new Array();
for (id value in pArray) {
addItemToArray(value, pRet);
Array* ret = new Array();
ret->init();
for (id value in array)
{
addItemToArray(value, ret);
}
return pRet;
return ret;
}
NS_CC_END

View File

@ -341,12 +341,12 @@ Array* FileUtilsMac::createArrayWithContentsOfFile(const std::string& filename)
NSString* pPath = [NSString stringWithUTF8String:fullPath.c_str()];
NSArray* array = [NSArray arrayWithContentsOfFile:pPath];
Array* pRet = Array::createWithCapacity( [array count] );
Array* ret = Array::createWithCapacity( [array count] );
for (id value in array) {
addItemToArray(value, pRet);
addItemToArray(value, ret);
}
return pRet;
return ret;
}

View File

@ -34,25 +34,31 @@ CCBAnimationManager::CCBAnimationManager()
bool CCBAnimationManager::init()
{
_sequences = Array::createWithCapacity(15);
_sequences->retain();
_sequences = new Array();
_sequences->init();
_nodeSequences = new Dictionary();
_nodeSequences->init();
_baseValues = new Dictionary();
_baseValues->init();
_documentOutletNames = Array::createWithCapacity(5);
_documentOutletNames->retain();
_documentOutletNodes = Array::createWithCapacity(5);
_documentOutletNodes->retain();
_documentCallbackNames = Array::createWithCapacity(5);
_documentCallbackNames->retain();
_documentCallbackNodes = Array::createWithCapacity(5);
_documentCallbackNodes->retain();
_documentCallbackControlEvents = Array::createWithCapacity(5);
_documentCallbackControlEvents->retain();
_keyframeCallbacks = Array::createWithCapacity(5);
_keyframeCallbacks->retain();
_documentOutletNames = new Array();
_documentOutletNames->init();
_documentOutletNodes = new Array();
_documentOutletNodes->init();
_documentCallbackNames = new Array();
_documentCallbackNames->init();
_documentCallbackNodes = new Array();
_documentCallbackNodes->init();
_documentCallbackControlEvents = new Array();
_documentCallbackControlEvents->init();
_keyframeCallbacks = new Array();
_keyframeCallbacks->init();
_keyframeCallFuncs = new Dictionary();
_keyframeCallFuncs->init();

View File

@ -153,12 +153,12 @@ const std::string& CCBReader::getCCBRootPath() const
bool CCBReader::init()
{
_ownerOutletNodes = Array::create();
_ownerOutletNodes->retain();
_ownerCallbackNodes = Array::create();
_ownerCallbackNodes->retain();
_ownerOwnerCallbackControlEvents = Array::create();
_ownerOwnerCallbackControlEvents->retain();
_ownerOutletNodes = new Array();
_ownerOutletNodes->init();
_ownerCallbackNodes = new Array();
_ownerCallbackNodes->init();
_ownerOwnerCallbackControlEvents = new Array();
_ownerOwnerCallbackControlEvents->init();
// Setup action manager
CCBAnimationManager *pActionManager = new CCBAnimationManager();
@ -280,10 +280,10 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
// Assign actionManagers to userObject
if(_jsControlled)
{
_nodesWithAnimationManagers = Array::create();
_nodesWithAnimationManagers->retain();
_animationManagersForNodes = Array::create();
_animationManagersForNodes->retain();
_nodesWithAnimationManagers = new Array();
_nodesWithAnimationManagers->init();
_animationManagersForNodes = new Array();
_animationManagersForNodes->init();
}
DictElement* pElement = NULL;

View File

@ -14,9 +14,9 @@ CCBSequenceProperty::CCBSequenceProperty()
bool CCBSequenceProperty::init()
{
_keyframes = Array::createWithCapacity(5);
_keyframes->retain();
_keyframes = new Array();
_keyframes->init();
return true;
}

View File

@ -109,8 +109,9 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/)
this->setViewSize(size);
setTouchEnabled(true);
_touches = Array::create();
_touches->retain();
_touches = new Array();
_touches->init();
_delegate = NULL;
_bounceable = true;
_clippingToBounds = true;

View File

@ -54,7 +54,9 @@ bool TableView::initWithViewSize(Size size, Node* container/* = NULL*/)
if (ScrollView::initWithViewSize(size,container))
{
_cellsUsed = new ArrayForObjectSorting();
_cellsUsed->init();
_cellsFreed = new ArrayForObjectSorting();
_cellsFreed->init();
_indices = new std::set<unsigned int>();
_vordering = VerticalFillOrder::BOTTOM_UP;
this->setDirection(Direction::VERTICAL);
@ -122,6 +124,7 @@ void TableView::reloadData()
_indices->clear();
_cellsUsed->release();
_cellsUsed = new ArrayForObjectSorting();
_cellsUsed->init();
this->_updateCellPositions();
this->_updateContentSize();

View File

@ -1 +1 @@
d17c1939227c62cebcc30a071cf81b12bfa08db3
69358d388dd779c6334c786e53ea14243bfde00b

View File

@ -720,6 +720,7 @@ static JSBool js_cocos2dx_CCControl_addTargetWithActionForControlEvents(JSContex
if (nullptr == nativeDelegateArray)
{
nativeDelegateArray = new Array();
nativeDelegateArray->init();
cobj->setUserObject(nativeDelegateArray); // The reference of nativeDelegateArray is added to 2
nativeDelegateArray->release(); // Release nativeDelegateArray to make the reference to 1
}