mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Merged in Glorf/ryzomcore/fix_item_group_08072017 (pull request #154)
Minor item group fixes : --HG-- branch : develop
This commit is contained in:
commit
cdf648fd4f
2 changed files with 30 additions and 2 deletions
|
@ -2960,6 +2960,8 @@ void CDBCtrlSheet::swapSheet(CDBCtrlSheet *other)
|
|||
swapDBProps(getItemRMClassTypePtr(), other->getItemRMClassTypePtr());
|
||||
swapDBProps(getItemRMFaberStatTypePtr(), other->getItemRMFaberStatTypePtr());
|
||||
swapDBProps(getItemPrerequisitValidPtr(), other->getItemPrerequisitValidPtr());
|
||||
swapDBProps(getItemSerialPtr(), other->getItemSerialPtr());
|
||||
swapDBProps(getItemCreateTimePtr(), other->getItemCreateTimePtr());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3539,6 +3541,10 @@ void CDBCtrlSheet::copyAspect(CDBCtrlSheet *dest)
|
|||
dest->setItemRMFaberStatType(getItemRMFaberStatType());
|
||||
// copy prerequisit valid flag
|
||||
dest->setItemPrerequisitValid(getItemPrerequisitValid());
|
||||
// copy item serial
|
||||
dest->setItemSerial(getItemSerial());
|
||||
// copy item create time
|
||||
dest->setItemCreateTime(getItemCreateTime());
|
||||
}
|
||||
// if brick, sphrase or sphraseId
|
||||
if(isSBrick() || isSPhrase() || isSPhraseId())
|
||||
|
|
|
@ -73,6 +73,21 @@ bool CItemGroup::contains(CDBCtrlSheet *other, SLOT_EQUIPMENT::TSlotEquipment &s
|
|||
|
||||
void CItemGroup::addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlotEquipment slot)
|
||||
{
|
||||
//Don't add an item if it already exists, this could cause issue
|
||||
// It's happening either if we are creating a group with a 2 hands items (and the item is found both in handR and handL)
|
||||
// Or if an user incorrectly edit his group file
|
||||
for(int i=0; i<Items.size(); i++)
|
||||
{
|
||||
if( Items[i].createTime == createTime && Items[i].serial == serial)
|
||||
{
|
||||
nldebug("Not adding duplicate item, createTime: %d, serial: %d", createTime, serial);
|
||||
//In this case, we are adding the duplicate item for a 2 hands item
|
||||
//If it's saved as a left hand item, save it as a right hand item instead (so we have only 1 correct item)
|
||||
if(Items[i].slot == SLOT_EQUIPMENT::TSlotEquipment::HANDL && slot == SLOT_EQUIPMENT::TSlotEquipment::HANDR)
|
||||
Items[i].slot = SLOT_EQUIPMENT::TSlotEquipment::HANDR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
Items.push_back(CItem(createTime, serial, slot));
|
||||
}
|
||||
|
||||
|
@ -158,9 +173,16 @@ void CItemGroup::readFrom(xmlNodePtr node)
|
|||
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"maxPrice");
|
||||
if (ptrName) NLMISC::fromString((const char*)ptrName, item.maxPrice);
|
||||
item.usePrice = (item.minPrice != 0 || item.maxPrice != std::numeric_limits<uint32>::max());
|
||||
|
||||
if(item.createTime != 0)
|
||||
{
|
||||
addItem(item.createTime, item.serial, item.slot);
|
||||
}
|
||||
// Old load : keep for compatibility / migration reasons
|
||||
else
|
||||
{
|
||||
Items.push_back(item);
|
||||
}
|
||||
}
|
||||
if (strcmp((char*)curNode->name, "remove") == 0)
|
||||
{
|
||||
std::string slot;
|
||||
|
|
Loading…
Reference in a new issue