MQ2Data.cpp updates
Posted: Wed Feb 14, 2018 1:45 am
I was looking through the FindItem TLOs and noticed they dont offer to FindItem by ID, any reason for this? If not all of the FindItem, FindItemCount, FindItemBank, and FindItemBank TLOs should be able to parse IDs via the PCONTENTS FindItemByID(int ItemID) in mq2utilities.cpp.
ie from:
To:
ie from:
Code: Select all
TLO(dataFindItem)
{
if (!ISINDEX())
return false;
PCHAR pName = GETFIRST();
BOOL bExact = false;
if (*pName == '=')
{
bExact = true;
pName++;
}
if (PCONTENTS pItem = FindItemByName(pName, bExact)) {
Ret.Ptr = pItem;
Ret.Type = pItemType;
return true;
}
return false;
}
Code: Select all
TLO(dataFindItem)
{
if (!ISINDEX())
return false;
if (ISNUMBER()) {
if(PCONTENTS pItem = FindItemByID(GETNUMBER())) {
Ret.Ptr = pItem;
Ret.Type = pItemType;
return true;
}
}
else {
PCHAR pName = GETFIRST();
BOOL bExact = false;
if (*pName == '=')
{
bExact = true;
pName++;
}
if (PCONTENTS pItem = FindItemByName(pName, bExact)) {
Ret.Ptr = pItem;
Ret.Type = pItemType;
return true;
}
return false;
}
}