Resolved conflicts.
authorsaiam
Tue, 18 Nov 2008 18:54:40 +0000
changeset 51 360208b631c1
parent 50 9e1a6506f5a1
child 52 8db6726c27fc
Resolved conflicts.
src/proto2/Physics.cc
src/proto2/Vector.hh
--- a/src/proto2/Physics.cc	Tue Nov 18 18:50:32 2008 +0000
+++ b/src/proto2/Physics.cc	Tue Nov 18 18:54:40 2008 +0000
@@ -30,8 +30,9 @@
     Vector newPosition = position + velocity * PHYSICS_TICK_MS * 1000;
 
     //TODO Handle the object as a square or a polygon
-    if (newPosition.x < 0 || (newPosition.x > PHYSICS_WORLD_WIDTH)
-       || (newPosition.y < 0) || (newPosition.y >= PHYSICS_WORLD_HEIGHT)) {
+
+    if(newPosition.x() < 0 || (newPosition.x() > PHYSICS_WORLD_WIDTH)
+       || (newPosition.y() < 0) || (newPosition.y() >= PHYSICS_WORLD_HEIGHT)) {
         
         // CRASH!
         this->velocity *= -1;
--- a/src/proto2/Vector.hh	Tue Nov 18 18:50:32 2008 +0000
+++ b/src/proto2/Vector.hh	Tue Nov 18 18:54:40 2008 +0000
@@ -3,6 +3,18 @@
 
 #include <complex>
 
-typedef std::complex<float> Vector;
+class Vector : std::complex<float> {
+
+public:
+    Vector(float x, float y) : std::complex<float> (x, y) {}
+
+    float x() const {
+	return this->real();
+    }
+
+    float y() const {
+	return this->imag();
+    }
+};
 
 #endif