//
// GameLevelManager::getNextFreeTemplateID from 0x4aa840 to 0x4aa8a2 (98 bytes)
//
// 1 xrefs:
// > GameLevelManager::createSmartTemplate @ 0x4aa8ae
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:49:58 +0000
//
int __fastcall GameLevelManager::getNextFreeTemplateID(cocos2d::CCArray **this)
{
unsigned int v2; // r4
int v3; // r5
cocos2d::CCNode *v4; // r6
cocos2d::CCObject *v5; // r8
int v6; // r0
int v7; // r2
int v8; // r4
v2 = 0;
v3 = 0;
v4 = (cocos2d::CCNode *)cocos2d::CCDictionary::create((cocos2d::CCDictionary *)this);
v5 = (cocos2d::CCObject *)cocos2d::CCNode::create(v4);
while ( v2 < cocos2d::CCArray::count(*(this + 243)) )
{
v6 = cocos2d::CCArray::objectAtIndex(*(this + 243), v2++);
v7 = *(_DWORD *)(v6 + 120);
if ( v3 < v7 )
v3 = *(_DWORD *)(v6 + 120);
cocos2d::CCDictionary::setObject(v4, v5, v7);
}
v8 = 1;
while ( cocos2d::CCDictionary::objectForKey(v4, v8) )
{
if ( ++v8 == 1001 )
return v3;
}
return v8;
}