Permalink
Browse files

Player::getSpeed/setSpeed use const refs

  • Loading branch information...
1 parent ab9f3b9 commit 3eb9ff555f16110eccc38d06e6d9946f6f563f5c @nerzhul nerzhul committed Aug 14, 2017
Showing with 4 additions and 4 deletions.
  1. +1 −1 src/camera.cpp
  2. +1 −1 src/clientiface.cpp
  3. +2 −2 src/player.h
View
@@ -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;
View
@@ -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();
View
@@ -104,12 +104,12 @@ class Player
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;
}

0 comments on commit 3eb9ff5

Please sign in to comment.