fix: optimization: PVS-Studio warning V835
Passing cheap-to-copy arguments by reference can sometimes lead to decreased performance. This change ensures that the argument is passed by value, which is more efficient in cases where the argument is inexpensive to copy. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
307ffc3c8f
commit
1bdc9cf759
@ -105,7 +105,7 @@ glm::vec3 CameraControl::updateCameraShaking(const Hitbox& hitbox, float delta)
|
||||
}
|
||||
|
||||
void CameraControl::updateFovEffects(const Hitbox& hitbox,
|
||||
const PlayerInput& input, float delta) {
|
||||
PlayerInput input, float delta) {
|
||||
bool crouch = input.shift && hitbox.grounded && !input.sprint;
|
||||
|
||||
float dt = fmin(1.0f, delta * ZOOM_SPEED);
|
||||
@ -146,7 +146,7 @@ void CameraControl::switchCamera() {
|
||||
}
|
||||
}
|
||||
|
||||
void CameraControl::update(const PlayerInput& input, float delta, Chunks* chunks) {
|
||||
void CameraControl::update(PlayerInput input, float delta, Chunks* chunks) {
|
||||
offset = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (auto hitbox = player->getHitbox()) {
|
||||
|
||||
@ -32,7 +32,7 @@ class CameraControl {
|
||||
/// @brief Update field-of-view effects
|
||||
/// @param input player inputs
|
||||
/// @param delta delta time
|
||||
void updateFovEffects(const Hitbox& hitbox, const PlayerInput& input,
|
||||
void updateFovEffects(const Hitbox& hitbox, PlayerInput input,
|
||||
float delta);
|
||||
|
||||
/// @brief Switch active player camera
|
||||
@ -41,7 +41,7 @@ public:
|
||||
CameraControl(const std::shared_ptr<Player>& player,
|
||||
const CameraSettings& settings);
|
||||
void updateMouse(PlayerInput& input);
|
||||
void update(const PlayerInput& input, float delta, Chunks* chunks);
|
||||
void update(PlayerInput input, float delta, Chunks* chunks);
|
||||
void refresh();
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user