Skip to content

Commit 90db558

Browse files
committed
Core/Objects: Eliminate unneccessary temporary objects and double map lookups when building SMSG_UPDATE_OBJECT
(cherry picked from commit 38a209276d9a6b3fb5e657711894a1b696933c59)
1 parent df17886 commit 90db558

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/server/game/Entities/Object/Object.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,15 +505,7 @@ void Object::ClearUpdateMask(bool remove)
505505

506506
void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) const
507507
{
508-
UpdateDataMapType::iterator iter = data_map.find(player);
509-
510-
if (iter == data_map.end())
511-
{
512-
std::pair<UpdateDataMapType::iterator, bool> p = data_map.emplace(player, UpdateData());
513-
ASSERT(p.second);
514-
iter = p.first;
515-
}
516-
508+
UpdateDataMapType::iterator iter = data_map.try_emplace(player).first;
517509
BuildValuesUpdateBlockForPlayer(&iter->second, iter->first);
518510
}
519511

0 commit comments

Comments
 (0)