|
|
@ -309,30 +309,32 @@ void DedicatedPlayer::setEquipment()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::ContainerStoreIterator it = invStore.getSlot(slot);
|
|
|
|
MWWorld::ContainerStoreIterator it = invStore.getSlot(slot);
|
|
|
|
|
|
|
|
|
|
|
|
const string &dedicItem = equipmentItems[slot].refId;
|
|
|
|
const string &packetItemId = equipmentItems[slot].refId;
|
|
|
|
std::string item = "";
|
|
|
|
std::string ptrItemId = "";
|
|
|
|
bool equal = false;
|
|
|
|
bool equal = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (it != invStore.end())
|
|
|
|
if (it != invStore.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item = it->getCellRef().getRefId();
|
|
|
|
ptrItemId = it->getCellRef().getRefId();
|
|
|
|
if (!Misc::StringUtils::ciEqual(item, dedicItem)) // if other item equiped
|
|
|
|
|
|
|
|
|
|
|
|
if (!Misc::StringUtils::ciEqual(ptrItemId, packetItemId)) // if other item is now equipped
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::ContainerStore &store = ptr.getClass().getContainerStore(ptr);
|
|
|
|
MWWorld::ContainerStore &store = ptr.getClass().getContainerStore(ptr);
|
|
|
|
store.remove(item, store.count(item), ptr);
|
|
|
|
store.remove(ptrItemId, store.count(ptrItemId), ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
equal = true;
|
|
|
|
equal = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (dedicItem.empty() || equal)
|
|
|
|
if (packetItemId.empty() || equal)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
const int count = equipmentItems[slot].count;
|
|
|
|
const int count = equipmentItems[slot].count;
|
|
|
|
ptr.getClass().getContainerStore(ptr).add(dedicItem, count, ptr);
|
|
|
|
ptr.getClass().getContainerStore(ptr).add(packetItemId, count, ptr);
|
|
|
|
|
|
|
|
|
|
|
|
for (const auto &itemPtr : invStore)
|
|
|
|
for (const auto &itemPtr : invStore)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (::Misc::StringUtils::ciEqual(itemPtr.getCellRef().getRefId(), dedicItem)) // equip item
|
|
|
|
if (::Misc::StringUtils::ciEqual(itemPtr.getCellRef().getRefId(), packetItemId)) // equip item
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::shared_ptr<MWWorld::Action> action = itemPtr.getClass().use(itemPtr);
|
|
|
|
std::shared_ptr<MWWorld::Action> action = itemPtr.getClass().use(itemPtr);
|
|
|
|
action->execute(ptr);
|
|
|
|
action->execute(ptr);
|
|
|
|