There are 2 lists, an active object list, and a more detailed list that contains thousands of records. The 'short' list is most important because you can use it to find units surrounding your player.
The object store is basically a hash table that uses a linked list to store the underlying data, hence enumerating it is really easy once you find a pointer to the head of the list.
The nodes of this list are in the following format:
Code:
struct WOW_LIST_ENTRY
{
WOW_LIST_ENTRY *pPrev;
struct ObjectListNode *pNext;
};
struct ObjectListNode
{
/*0x000*/ void *__vftable;
/*0x004*/ void *pData; //useful for some other objects.
/*0x008*/ void* pDescriptor; //points to a struct detailed in the previous post of mine
/*0x00c*/ QWORD Unk3;
/*0x014*/ int Type;
/*0x018*/ DWORD Unk4;
/*0x01c*/ WOW_LIST_ENTRY BucketList; //enumate the list of stuff.
/*0x024*/ WOW_LIST_ENTRY FullList;
/*0x02c*/ DWORD pad3;
/*0x030*/ QWORD Id;
/*0x038*/ DWORD pad4[0x3C];
};
Code:
int LoadVisibleObjectData()
{
CWowObjectIteratorHandlers::InitHandlers(Enumerators, 8);
ObjectListNode *ObjListHead = 0;
Unk1 *pUnk = GetWowObjectBuffer();
if(pUnk == NULL)
return 0;
POBJECT_BUCKET pBucketHead = pUnk->pBucketHead;
if(pBucketHead == NULL)
return 0;
int Count = 0;
for(DWORD i = 0; i < pUnk->BucketLength; i++)
{
ObjectListNode *Cur = pBucketHead[i].pObject;
while (IsValidWowPtr((void*)Cur) )
{
//Ensure item type is something we can handle and is the requested type.
if( (Cur->Type >= 0 && Cur->Type < 8) )
{
Enumerators[Cur->Type](Cur);
}
//Point to the next item in list.
Cur = Cur->BucketList.pNext;
Count++;
}
}
return 0;
}