Skip to content

Commit 21878c9

Browse files
committedMay 27, 2015
Spare some string copies
1 parent f16ebbf commit 21878c9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

Diff for: ‎src/content_sao.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -541,13 +541,13 @@ void LuaEntitySAO::setAnimation(v2f frame_range, float frame_speed, float frame_
541541
m_animation_sent = false;
542542
}
543543

544-
void LuaEntitySAO::setBonePosition(std::string bone, v3f position, v3f rotation)
544+
void LuaEntitySAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)
545545
{
546546
m_bone_position[bone] = core::vector2d<v3f>(position, rotation);
547547
m_bone_position_sent = false;
548548
}
549549

550-
void LuaEntitySAO::setAttachment(int parent_id, std::string bone, v3f position, v3f rotation)
550+
void LuaEntitySAO::setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation)
551551
{
552552
// Attachments need to be handled on both the server and client.
553553
// If we just attach on the server, we can only copy the position of the parent. Attachments
@@ -1142,14 +1142,14 @@ void PlayerSAO::setAnimation(v2f frame_range, float frame_speed, float frame_ble
11421142
m_animation_sent = false;
11431143
}
11441144

1145-
void PlayerSAO::setBonePosition(std::string bone, v3f position, v3f rotation)
1145+
void PlayerSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)
11461146
{
11471147
// store these so they can be updated to clients
11481148
m_bone_position[bone] = core::vector2d<v3f>(position, rotation);
11491149
m_bone_position_sent = false;
11501150
}
11511151

1152-
void PlayerSAO::setAttachment(int parent_id, std::string bone, v3f position, v3f rotation)
1152+
void PlayerSAO::setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation)
11531153
{
11541154
// Attachments need to be handled on both the server and client.
11551155
// If we just attach on the server, we can only copy the position of the parent. Attachments

Diff for: ‎src/content_sao.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class LuaEntitySAO : public ServerActiveObject
5959
s16 getHP() const;
6060
void setArmorGroups(const ItemGroupList &armor_groups);
6161
void setAnimation(v2f frame_range, float frame_speed, float frame_blend);
62-
void setBonePosition(std::string bone, v3f position, v3f rotation);
63-
void setAttachment(int parent_id, std::string bone, v3f position, v3f rotation);
62+
void setBonePosition(const std::string &bone, v3f position, v3f rotation);
63+
void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation);
6464
ObjectProperties* accessObjectProperties();
6565
void notifyObjectPropertiesModified();
6666
/* LuaEntitySAO-specific */
@@ -193,8 +193,8 @@ class PlayerSAO : public ServerActiveObject
193193
void setBreath(u16 breath);
194194
void setArmorGroups(const ItemGroupList &armor_groups);
195195
void setAnimation(v2f frame_range, float frame_speed, float frame_blend);
196-
void setBonePosition(std::string bone, v3f position, v3f rotation);
197-
void setAttachment(int parent_id, std::string bone, v3f position, v3f rotation);
196+
void setBonePosition(const std::string &bone, v3f position, v3f rotation);
197+
void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation);
198198
ObjectProperties* accessObjectProperties();
199199
void notifyObjectPropertiesModified();
200200
void setNametagColor(video::SColor color);

0 commit comments

Comments
 (0)
Please sign in to comment.