From 3f304866fdca50df7a56c94dc09b37fe66a311eb Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 24 Sep 2018 10:11:42 +0300 Subject: [PATCH] [Client] Use clearer variable names in DedicatedPlayer::setEquipment() --- apps/openmw/mwmp/DedicatedPlayer.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 409103fdd..a832e0bc2 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -309,30 +309,32 @@ void DedicatedPlayer::setEquipment() { MWWorld::ContainerStoreIterator it = invStore.getSlot(slot); - const string &dedicItem = equipmentItems[slot].refId; - std::string item = ""; + const string &packetItemId = equipmentItems[slot].refId; + std::string ptrItemId = ""; bool equal = false; + if (it != invStore.end()) { - item = it->getCellRef().getRefId(); - if (!Misc::StringUtils::ciEqual(item, dedicItem)) // if other item equiped + ptrItemId = it->getCellRef().getRefId(); + + if (!Misc::StringUtils::ciEqual(ptrItemId, packetItemId)) // if other item is now equipped { MWWorld::ContainerStore &store = ptr.getClass().getContainerStore(ptr); - store.remove(item, store.count(item), ptr); + store.remove(ptrItemId, store.count(ptrItemId), ptr); } else equal = true; } - if (dedicItem.empty() || equal) + if (packetItemId.empty() || equal) continue; 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) { - if (::Misc::StringUtils::ciEqual(itemPtr.getCellRef().getRefId(), dedicItem)) // equip item + if (::Misc::StringUtils::ciEqual(itemPtr.getCellRef().getRefId(), packetItemId)) // equip item { std::shared_ptr action = itemPtr.getClass().use(itemPtr); action->execute(ptr);