Hello kira.
I already did a lot of this stuff in the language autoit, which is pretty easy to convert to c++. Here's an example of what you want to do (converted, not tested):
HANDLE g_hProc;
inline DWORD pread(DWORD address, HANDLE hProc = g_hProc) {
DWORD temp;
ReadProcessMemory(hProc,(void*)address, &temp, sizeof(temp),NULL);
return temp;
}
struct Item
{
DWORD pAddress;
DWORD dwClassId;
DWORD dwUnitId;
};
typedef std::vector<Item> ItemList;
ItemList ItemsOnGround() {
DWORD Unit = 0; //UnitAny * Unit;
ItemList ret;
Item cur_item;
//This for() loop iterates through all room2's visible
for(DWORD ptRoomOther = pread(pRoom2First +
pread(pLevel +
pread(pRoom2 +
pread(pRoom1 +
pread(pPath +
pread(povUnit)))))); //Room2* ptRoomOther = Unit->pPath->pRoom1->pRoom2->pLevel->pRoom2First
ptRoomOther;
ptRoomOther = pread(ptRoomOther + pRoom2Next)) //ptRoomOther = ptRoomOther->pRoom2Next
{
//This for() loop iterates through all units in current room2
for(Unit = pread(pUnitFirst + pread(pRRoom1 + ptRoomOther));
Unit;
Unit = pread(Unit + 0xE8)) // Unit = Unit->pListNext
{
if(pread(Unit) == UNIT_ITEM) // if(unit->dwType == UNIT_ITEM)
{
//Current unit is an item. store some information about it in the return array
cur_item.dwClassId = pread(Unit + 0x04);
cur_item.pAddress = Unit;
cur_item.dwUnitId = pread(Unit + 0x0C);
ret.push_back(cur_item);
}
}
}
return ret;
}
You can find original code for this in the library i posted here:
viewtopic.php?f=182&t=485262specifically, you want to go to \libs\common\units.au3
constants for the code i posted can be found in \libs\autumn\au.vars.au3
Good luck
