//
// GameLevelManager::getNextFreeTemplateID from 0x10009a6f0 to 0x10009a7ac (188 bytes)
//
// 1 xrefs:
// > GameLevelManager::createSmartTemplate @ 0x10009a7c8
//
// 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 __fastcall GameLevelManager::getNextFreeTemplateID(GameLevelManager *a1)
{
cocos2d::CCDictionary *v2; // x19
cocos2d::CCNode *v3; // x22
__int64 v4; // x23
int v5; // w20
intptr_t v6; // x2
intptr_t v7; // x21
v2 = cocos2d::CCDictionary::create();
v3 = cocos2d::CCNode::create();
if ( (unsigned int)sub_10024A36C(a1->m_smartTemplates) )
{
v4 = 0;
v5 = 0;
do
{
v6 = *(int *)(sub_10024A388(a1->m_smartTemplates, v4) + 192);
if ( (int)v6 > v5 )
v5 = v6;
cocos2d::CCDictionary::setObject(v2, v3, v6);
v4 = (unsigned int)(v4 + 1);
}
while ( (unsigned int)v4 < (unsigned int)sub_10024A36C(a1->m_smartTemplates) );
}
else
{
v5 = 0;
}
v7 = 1;
while ( cocos2d::CCDictionary::objectForKey(v2, v7) )
{
if ( ++v7 == 1001 )
return v5;
}
return v7;
}