1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Value copy / allocation optimizations mostly in server, SAO and serialize code

This commit is contained in:
sfan5 2020-05-26 17:38:31 +02:00
parent 2fd5f38c45
commit 471e567657
16 changed files with 52 additions and 64 deletions

View file

@ -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);
}
}