From 90db558697fb1253d9195e4d4743be80ca1968b7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 28 Oct 2024 00:52:19 +0100 Subject: [PATCH] Core/Objects: Eliminate unneccessary temporary objects and double map lookups when building SMSG_UPDATE_OBJECT (cherry picked from commit 38a209276d9a6b3fb5e657711894a1b696933c59) --- src/server/game/Entities/Object/Object.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 74cfa6e9bb..f74b666884 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -505,15 +505,7 @@ void Object::ClearUpdateMask(bool remove) void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) const { - UpdateDataMapType::iterator iter = data_map.find(player); - - if (iter == data_map.end()) - { - std::pair p = data_map.emplace(player, UpdateData()); - ASSERT(p.second); - iter = p.first; - } - + UpdateDataMapType::iterator iter = data_map.try_emplace(player).first; BuildValuesUpdateBlockForPlayer(&iter->second, iter->first); }