From bc17b5eb1a961bc0833765d04287b3d890cc828a Mon Sep 17 00:00:00 2001 From: Guillaume Dupuy Date: Sat, 8 Jul 2017 14:55:18 +0200 Subject: [PATCH] Don't add multiples identical items to a group Solves the issue where 2 hand weapon were not properly equipped --HG-- branch : fix_item_group_08072017 --- code/ryzom/client/src/item_group_manager.cpp | 26 ++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/item_group_manager.cpp b/code/ryzom/client/src/item_group_manager.cpp index bd94f4231..3cc45f5f9 100644 --- a/code/ryzom/client/src/item_group_manager.cpp +++ b/code/ryzom/client/src/item_group_manager.cpp @@ -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::max()); - - Items.push_back(item); + 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) {