//
// GameLevelManager::getNextFreeTemplateID from 0x3c041a to 0x3c047c (98 bytes)
//
// 1 xrefs:
// > GameLevelManager::createSmartTemplate @ 0x3c0488
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int GameLevelManager::getNextFreeTemplateID(GameLevelManager *a1)
{
unsigned int v2; // r4
int v3; // r5
cocos2d::CCDictionary *v4; // r6
cocos2d::CCNode *v5; // r8
int v6; // r0
intptr_t v7; // r2
intptr_t v8; // r4
v2 = 0;
v3 = 0;
v4 = cocos2d::CCDictionary::create();
v5 = cocos2d::CCNode::create();
while ( v2 < cocos2d::CCArray::count(a1->m_smartTemplates) )
{
v6 = cocos2d::CCArray::objectAtIndex(a1->m_smartTemplates, v2++);
v7 = *(_DWORD *)(v6 + 116);
if ( v3 < v7 )
v3 = *(_DWORD *)(v6 + 116);
cocos2d::CCDictionary::setObject(v4, v5, v7);
}
v8 = 1;
while ( cocos2d::CCDictionary::objectForKey(v4, v8) )
{
if ( ++v8 == 1001 )
return v3;
}
return v8;
}