aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-08-14 10:56:06 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-08-14 10:56:06 +0200
commit3eb9ff555f16110eccc38d06e6d9946f6f563f5c (patch)
treec1cae0ef540175d6466b59a174cca74e1fddef5f /src
parentab9f3b92f2d4affe396692bc4963a9a2375bcbd4 (diff)
downloadminetest-3eb9ff555f16110eccc38d06e6d9946f6f563f5c.tar.gz
minetest-3eb9ff555f16110eccc38d06e6d9946f6f563f5c.tar.bz2
minetest-3eb9ff555f16110eccc38d06e6d9946f6f563f5c.zip
Player::getSpeed/setSpeed use const refs
Diffstat (limited to 'src')
-rw-r--r--src/camera.cpp2
-rw-r--r--src/clientiface.cpp2
-rw-r--r--src/player.h4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index efd8a3389..7406aba03 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -526,7 +526,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
// If the player is walking, swimming, or climbing,
// view bobbing is enabled and free_move is off,
// start (or continue) the view bobbing animation.
- v3f speed = player->getSpeed();
+ const v3f &speed = player->getSpeed();
const bool movement_XZ = hypot(speed.X, speed.Z) > BS;
const bool movement_Y = fabs(speed.Y) > BS;
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index 361315c3b..fdabcc783 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -95,7 +95,7 @@ void RemoteClient::GetNextBlocks (
}
v3f playerpos = sao->getBasePosition();
- v3f playerspeed = player->getSpeed();
+ const v3f &playerspeed = player->getSpeed();
v3f playerspeeddir(0,0,0);
if(playerspeed.getLength() > 1.0*BS)
playerspeeddir = playerspeed / playerspeed.getLength();
diff --git a/src/player.h b/src/player.h
index 0b2cbbfb2..1d9882775 100644
--- a/src/player.h
+++ b/src/player.h
@@ -104,12 +104,12 @@ public:
std::vector<CollisionInfo> *collision_info)
{}
- v3f getSpeed()
+ const v3f &getSpeed() const
{
return m_speed;
}
- void setSpeed(v3f speed)
+ void setSpeed(const v3f &speed)
{
m_speed = speed;
}