From d09a1be33a647aedc12ce5ddcb7ea4ee23a75c8c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 30 Jul 2008 16:00:49 +0000 Subject: various minor issues: ESC closing chat, g_autolevel --- src/math/functions.h | 7 +++++-- src/math/vector3f.cc | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/math') diff --git a/src/math/functions.h b/src/math/functions.h index 3d5d056..be6919d 100644 --- a/src/math/functions.h +++ b/src/math/functions.h @@ -49,9 +49,12 @@ float degrees180f(float angle); float degrees360f(float angle); /// clamp a float to a specified range -inline void clamp(float &value, float min=0.0f, float max=1.0f) +inline void clamp(float &value, const float min=0.0f, const float max=1.0f) { - if (value < min) value = min; else if (value > max) value = max; + if (value < min) + value = min; + else if (value > max) + value = max; } /// return the absolute value of a float diff --git a/src/math/vector3f.cc b/src/math/vector3f.cc index d5173bb..57ad52a 100644 --- a/src/math/vector3f.cc +++ b/src/math/vector3f.cc @@ -49,7 +49,9 @@ void Vector3f::assign(const float vx, const float vy, const float vz) void Vector3f::assign(Vector3f const & other) { - memcpy(coord, other.coord, sizeof(coord)); + coord[0] = other.coord[0]; + coord[1] = other.coord[1]; + coord[2] = other.coord[2]; } Vector3f & Vector3f::operator=(const Vector3f & other) -- cgit v1.2.3