//
// cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject from 0x180014790 to 0x18001490f (383 bytes)
//
// 4 xrefs:
// > ??> @ 0x18002ec1c
// > ??> @ 0x18002ec2c
// > ??> @ 0x18002fdf8
// > ??> @ 0x18004a680
//
// 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
//
void __fastcall cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject(
cocos2d::extension::CCArrayForObjectSorting *this,
unsigned int a2,
struct cocos2d::extension::CCSortableObject *a3)
{
unsigned int v3; // edi
unsigned int v7; // ebp
unsigned int v8; // esi
unsigned int *v9; // rbx
__int64 v10; // rax
_QWORD *v11; // rbx
_QWORD *i; // r15
__int64 v13; // rax
unsigned int v14; // eax
struct cocos2d::CCObject *v15; // rax
struct cocos2d::extension::CCSortableObject *v16; // rsi
cocos2d::CCObject *v17; // rbp
int v18; // ebx
v3 = 0;
if ( a3 )
{
v7 = 0;
v8 = (*(__int64 (__fastcall **)(struct cocos2d::extension::CCSortableObject *))(*(_QWORD *)a3 + 16LL))(a3);
if ( this )
{
v9 = *((unsigned int **)this + 7);
v10 = *v9;
if ( (_DWORD)v10 )
{
v11 = *((_QWORD **)v9 + 2);
for ( i = &v11[v10 - 1]; v11 <= i; v7 = v14 )
{
if ( !*v11 )
break;
v13 = _RTDynamicCast(
*v11,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::extension::CCSortableObject `RTTI Type Descriptor',
0);
v14 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 16LL))(v13);
if ( v8 == v14 || v8 >= v7 && v8 < v14 )
break;
++v3;
++v11;
}
}
}
}
else
{
v3 = -1;
}
if ( v3 < cocos2d::CCArray::count(this) && v3 != -1 )
{
v15 = cocos2d::CCArray::objectAtIndex(this, v3);
v16 = (struct cocos2d::extension::CCSortableObject *)_RTDynamicCast(
v15,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::extension::CCSortableObject `RTTI Type Descriptor',
0);
v17 = (cocos2d::CCObject *)_RTDynamicCast(
v16,
0,
&cocos2d::extension::CCSortableObject `RTTI Type Descriptor',
&cocos2d::CCObject `RTTI Type Descriptor',
0);
cocos2d::CCObject::retain(v17);
v18 = (*(__int64 (__fastcall **)(struct cocos2d::extension::CCSortableObject *))(*(_QWORD *)v16 + 16LL))(v16);
if ( v18 == (*(unsigned int (__fastcall **)(struct cocos2d::extension::CCSortableObject *))(*(_QWORD *)a3 + 16LL))(a3) )
{
cocos2d::CCArray::removeObjectAtIndex(this, v3, 1);
(*(void (__fastcall **)(struct cocos2d::extension::CCSortableObject *, _QWORD))(*(_QWORD *)v16 + 8LL))(v16, a2);
cocos2d::extension::CCArrayForObjectSorting::insertSortedObject(this, v16);
}
cocos2d::CCObject::release(v17);
}
}