//
// GameLevelManager::getNextFreeTemplateID from 0x6f425c to 0x6f4320 (196 bytes)
//
// 2 xrefs:
// > GameLevelManager::createSmartTemplate @ 0x6f433c
// > ??> @ 0xaf080
//
// 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; // w19
cocos2d::CCDictionary *v3; // x21
int v4; // w20
cocos2d::CCNode *i; // x23
int v6; // w3
bool v7; // cf
unsigned int v8; // w1
intptr_t j; // x19
v2 = 0;
v3 = cocos2d::CCDictionary::create();
v4 = 0;
for ( i = cocos2d::CCNode::create(); ; cocos2d::CCDictionary::setObject(v3, i, v6) )
{
v7 = v2 >= (unsigned int)cocos2d::CCArray::count(a1->m_smartTemplates);
v8 = v2++;
if ( v7 )
break;
v6 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(a1->m_smartTemplates, v8) + 184);
if ( v4 < v6 )
v4 = v6;
}
for ( j = 1; j != 1001; ++j )
{
if ( !cocos2d::CCDictionary::objectForKey(v3, j) )
return j;
}
return v4;
}