//
// GameLevelManager::getNextFreeTemplateID from 0x80101c to 0x8010e0 (196 bytes)
//
// 2 xrefs:
// > GameLevelManager::createSmartTemplate @ 0x8010fc
// > ??> @ 0xe50f0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:54:43 +0000
//
__int64 __fastcall GameLevelManager::getNextFreeTemplateID(cocos2d::CCArray **this)
{
unsigned int v2; // w19
cocos2d::CCNode *v3; // x21
unsigned int v4; // w20
cocos2d::CCObject *i; // x23
int v6; // w3
bool v7; // cf
unsigned int v8; // w1
__int64 j; // x19
v2 = 0;
v3 = (cocos2d::CCNode *)cocos2d::CCDictionary::create((cocos2d::CCDictionary *)this);
v4 = 0;
for ( i = (cocos2d::CCObject *)cocos2d::CCNode::create(v3); ; cocos2d::CCDictionary::setObject(v3, i, v6) )
{
v7 = v2 >= (unsigned int)cocos2d::CCArray::count(*(this + 190));
v8 = v2++;
if ( v7 )
break;
v6 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(*(this + 190), v8) + 192);
if ( (int)v4 < v6 )
v4 = v6;
}
for ( j = 1; j != 1001; ++j )
{
if ( !cocos2d::CCDictionary::objectForKey(v3, j) )
return (unsigned int)j;
}
return v4;
}