diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-05-27 22:26:44 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-05-27 22:29:42 +0200 |
commit | b22d852b4c4aa89e0394397a703ecfa442b0a928 (patch) | |
tree | a1e29142aabf11393eb3e0604deb4b89a6124fe7 /src/math | |
parent | 12313fecf5a0ccad45f88575a24582b8363bd5a7 (diff) | |
download | colobot-b22d852b4c4aa89e0394397a703ecfa442b0a928.tar.gz colobot-b22d852b4c4aa89e0394397a703ecfa442b0a928.tar.bz2 colobot-b22d852b4c4aa89e0394397a703ecfa442b0a928.zip |
Fixed variable shadowing warnings
* fixed -Wshadow warnings
* refactored some constructors
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/matrix.h | 8 | ||||
-rw-r--r-- | src/math/point.h | 15 | ||||
-rw-r--r-- | src/math/vector.h | 18 |
3 files changed, 20 insertions, 21 deletions
diff --git a/src/math/matrix.h b/src/math/matrix.h index 67ccb48..a13f823 100644 --- a/src/math/matrix.h +++ b/src/math/matrix.h @@ -73,10 +73,10 @@ struct Matrix //! Creates the matrix from 1D array /** \a m matrix values in column-major order */ - inline explicit Matrix(const float (&m)[16]) + inline explicit Matrix(const float (&_m)[16]) { for (int i = 0; i < 16; ++i) - this->m[i] = m[i]; + m[i] = _m[i]; } //! Creates the matrix from 2D array @@ -84,13 +84,13 @@ struct Matrix * The array's first index is row, second is column. * \param m array with values */ - inline explicit Matrix(const float (&m)[4][4]) + inline explicit Matrix(const float (&_m)[4][4]) { for (int c = 0; c < 4; ++c) { for (int r = 0; r < 4; ++r) { - this->m[4*c+r] = m[r][c]; + m[4*c+r] = _m[r][c]; } } } diff --git a/src/math/point.h b/src/math/point.h index 65de94c..edb902b 100644 --- a/src/math/point.h +++ b/src/math/point.h @@ -52,16 +52,15 @@ struct Point //! Constructs a zero point: (0,0) inline Point() - { - LoadZero(); - } + : x(0.0f) + , y(0.0f) + {} //! Constructs a point from given coords: (x,y) - inline explicit Point(float x, float y) - { - this->x = x; - this->y = y; - } + inline explicit Point(float _x, float _y) + : x(_x) + , y(_y) + {} //! Sets the zero point: (0,0) inline void LoadZero() diff --git a/src/math/vector.h b/src/math/vector.h index 38886d0..6827785 100644 --- a/src/math/vector.h +++ b/src/math/vector.h @@ -57,17 +57,17 @@ struct Vector //! Creates a zero vector (0, 0, 0) inline Vector() - { - LoadZero(); - } + : x(0.0f) + , y(0.0f) + , z(0.0f) + {} //! Creates a vector from given values - inline explicit Vector(float x, float y, float z) - { - this->x = x; - this->y = y; - this->z = z; - } + inline explicit Vector(float _x, float _y, float _z) + : x(_x) + , y(_y) + , z(_z) + {} //! Loads the zero vector (0, 0, 0) inline void LoadZero() |