From 5e563be3e14901671d5c506ffe13033164657c6d Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Tue, 17 Nov 2009 21:43:06 +0000 Subject: [PATCH] Finished -Weffc++ cleanup SVN-Revision: 6015 --- src/math/aatriangle.hpp | 30 ++++++++++++++++++++++++------ src/object/particlesystem.hpp | 4 ++++ src/object/particlesystem_interactive.hpp | 4 ++++ src/supertux/collision.cpp | 1 + 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/math/aatriangle.hpp b/src/math/aatriangle.hpp index c9defc8db..e37fa8afc 100644 --- a/src/math/aatriangle.hpp +++ b/src/math/aatriangle.hpp @@ -17,13 +17,13 @@ #ifndef HEADER_SUPERTUX_MATH_AATRIANGLE_HPP #define HEADER_SUPERTUX_MATH_AATRIANGLE_HPP -#include "math/rect.hpp" +#include "math/vector.hpp" /** * An axis-aligned triangle (ie. a triangle where 2 sides are parallel to the x- * and y-axis. */ -class AATriangle : public Rect // FIXME: yuck +class AATriangle { public: /** Directions: @@ -49,15 +49,33 @@ public: DEFORM_MASK = 0x0070 }; - AATriangle() - : dir(SOUTHWEST) +public: + AATriangle() : + p1(), + p2(), + dir(SOUTHWEST) + { + } + AATriangle(const Vector& v1, const Vector& v2, int newdir) : + p1(v1), + p2(v2), + dir(newdir) { } - AATriangle(const Vector& v1, const Vector& v2, int newdir) - : Rect(v1, v2), dir(newdir) + + float get_width() const { + return p2.x - p1.x; } + float get_height() const + { + return p2.y - p1.y; + } + +public: + Vector p1; + Vector p2; int dir; }; diff --git a/src/object/particlesystem.hpp b/src/object/particlesystem.hpp index 735552c21..38eac9526 100644 --- a/src/object/particlesystem.hpp +++ b/src/object/particlesystem.hpp @@ -64,6 +64,10 @@ protected: Vector pos; Surface* texture; + + private: + Particle(const Particle&); + Particle& operator=(const Particle&); }; float max_particle_size; diff --git a/src/object/particlesystem_interactive.hpp b/src/object/particlesystem_interactive.hpp index 991fff74d..296b3ff59 100644 --- a/src/object/particlesystem_interactive.hpp +++ b/src/object/particlesystem_interactive.hpp @@ -57,6 +57,10 @@ protected: Vector pos; Surface* texture; + + private: + Particle(const Particle&); + Particle& operator=(const Particle&); }; int collision(Particle* particle, Vector movement); diff --git a/src/supertux/collision.cpp b/src/supertux/collision.cpp index 716808d02..2718a0673 100644 --- a/src/supertux/collision.cpp +++ b/src/supertux/collision.cpp @@ -19,6 +19,7 @@ #include #include "math/aatriangle.hpp" +#include "math/rect.hpp" namespace collision { -- 2.11.0