diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 474d4a5a2c1..3670a3d83b8 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -4919,9 +4919,9 @@ bool Player::canWear(uint16_t lookType, uint8_t addons) const { return true; } - for (const auto &[outfitPlayer, addonPlayer] : outfitsMap) { - if (outfitPlayer == lookType) { - if (addonPlayer == addons || addonPlayer == 3 || addons == 0) { + for (const auto &outfitEntry : outfitsMap) { + if (outfitEntry.lookType == lookType) { + if (outfitEntry.addons == addons || outfitEntry.addons == 3 || addons == 0) { return true; } return false; // have lookType on list and addons don't match @@ -4960,9 +4960,9 @@ void Player::genReservedStorageRange() { } void Player::addOutfit(uint16_t lookType, uint8_t addons) { - for (auto &[outfitPlayer, addonPlayer] : outfitsMap) { - if (outfitPlayer == lookType) { - addonPlayer |= addons; + for (auto &outfitEntry : outfitsMap) { + if (outfitEntry.lookType == lookType) { + outfitEntry.addons |= addons; return; } } @@ -4979,9 +4979,9 @@ bool Player::removeOutfit(uint16_t lookType) { } bool Player::removeOutfitAddon(uint16_t lookType, uint8_t addons) { - for (auto &[outfitPlayer, addonPlayer] : outfitsMap) { - if (outfitPlayer == lookType) { - addonPlayer &= ~addons; + for (auto &outfitEntry : outfitsMap) { + if (outfitEntry.lookType == lookType) { + outfitEntry.addons &= ~addons; return true; } } @@ -4998,12 +4998,12 @@ bool Player::getOutfitAddons(const std::shared_ptr &outfit, uint8_t &add return false; } - for (const auto &[outfitPlayer, addonPlayer] : outfitsMap) { - if (outfitPlayer != outfit->lookType) { + for (const auto &outfitEntry : outfitsMap) { + if (outfitEntry.lookType != outfit->lookType) { continue; } - addons = addonPlayer; + addons = outfitEntry.addons; return true; } diff --git a/src/creatures/players/player.hpp b/src/creatures/players/player.hpp index 343bb0dcb8d..6e178c05166 100644 --- a/src/creatures/players/player.hpp +++ b/src/creatures/players/player.hpp @@ -2745,7 +2745,7 @@ class Player final : public Creature, public Cylinder, public Bankable { std::vector quickLootListItemIds; - phmap::flat_hash_map outfitsMap; + phmap::parallel_flat_hash_map outfitsMap; std::unordered_set mountsMap; std::vector familiars;