Hi All.
In this code, im sorting out objects (units and players)
Code:
unsigned ObjectManager::GetAllVisibleObjects()
{
unsigned curObj;
curObj=ProcessWorker::ReadUInt(baseAddress+0x0D8);
int c=0;
while ((curObj!=0) && (curObj & 1)==0)
{
curObj=ProcessWorker::ReadUInt(curObj+0x03C);
WowObject wo=WowObject(curObj);
if (wo.GetType()==3)
{
WowUnit wu=WowUnit(curObj);
wchar_t * name=wu.GetName();
wprintf(L"%s \n",name);
delete(name);
}
else if (wo.GetType()==4)
{
WowPlayer wpp= WowPlayer(curObj);
wchar_t *name;
name =wpp.GetName();
wprintf(L"%s,Player!!!!!! \n",name);
delete(name);
}
}
return 0;
}
It works good, finds active players object first and prints it name, but sometimes, it can not find active player, and print other units and player names, without him.
Pls, explain me what im doing wrong.
Maybe something wrong in my program, and i simply missing it, or maybe i shouldn`t search active player by objectType, and search it by GUID?
Like this
Code:
if (wo.GetGuid()==GetLocalGuid())
{
//FOUND!!!!
}
Thank you very much