diff options
author | sfan5 <sfan5@live.de> | 2020-05-26 17:38:31 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2020-05-27 21:58:40 +0200 |
commit | 471e567657dfd75a994a1b54d7a23cf4541a6bed (patch) | |
tree | 1b909e24669141f3fba2a6d98c68e22f1288249b /src/server/luaentity_sao.cpp | |
parent | 2fd5f38c45a3b57a9ea2d566aa50f9e5c33794d2 (diff) | |
download | minetest-471e567657dfd75a994a1b54d7a23cf4541a6bed.tar.gz minetest-471e567657dfd75a994a1b54d7a23cf4541a6bed.tar.bz2 minetest-471e567657dfd75a994a1b54d7a23cf4541a6bed.zip |
Value copy / allocation optimizations mostly in server, SAO and serialize code
Diffstat (limited to 'src/server/luaentity_sao.cpp')
-rw-r--r-- | src/server/luaentity_sao.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/server/luaentity_sao.cpp b/src/server/luaentity_sao.cpp index 51e1ca90e..8174da265 100644 --- a/src/server/luaentity_sao.cpp +++ b/src/server/luaentity_sao.cpp @@ -119,8 +119,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) m_properties_sent = true; std::string str = getPropertyPacket(); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } // If attached, check that our parent is still there. If it isn't, detach. @@ -228,16 +227,14 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) m_animation_sent = true; std::string str = generateUpdateAnimationCommand(); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } if (!m_animation_speed_sent) { m_animation_speed_sent = true; std::string str = generateUpdateAnimationSpeedCommand(); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } if (!m_bone_position_sent) { @@ -247,8 +244,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) std::string str = generateUpdateBonePositionCommand((*ii).first, (*ii).second.X, (*ii).second.Y); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } } @@ -256,8 +252,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) m_attachment_sent = true; std::string str = generateUpdateAttachmentCommand(); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } } |