src/PhysicsObject.cc
changeset 408 e6cfc44266af
parent 370 39e59dd36b6e
child 427 01e77fe8c040
--- a/src/PhysicsObject.cc	Tue Jan 20 23:24:04 2009 +0200
+++ b/src/PhysicsObject.cc	Tue Jan 20 23:30:18 2009 +0200
@@ -115,8 +115,8 @@
 }
 
 bool PhysicsObject::possibleLocation (Vector loc) {
-    for(unsigned int i = 0; i < this->shape.size(); i++) {
-        if(world.collides(loc+shape[i]))
+    for (unsigned int i = 0; i < this->shape.size(); i++) {
+        if (world.terrain.collides(loc+shape[i]))
             return false;
     }
     return true;
@@ -156,9 +156,9 @@
     // If the player has stopped and there's some ground under some of the 3 some of the 3t
     // set inAir false
     if (this->velocity == Vector(0,0)) {
-        this->inAir = !world.collides(this->position+shape[1]+Vector(0, 1))
-                      && !world.collides(this->position+shape[2]+Vector(0, 1))
-                      && !world.collides(this->position+shape[3]+Vector(0, 1));
+        this->inAir = !world.terrain.collides(this->position+shape[1]+Vector(0, 1))
+                      && !world.terrain.collides(this->position+shape[2]+Vector(0, 1))
+                      && !world.terrain.collides(this->position+shape[3]+Vector(0, 1));
         // If, however, there's a force caused by a bomb, e.g., set it in air.
         // Still, we have to be able to separate forces caused by walking attempts
         // and bombs etc (+0.1 because float comparison can be dangerous)
@@ -209,12 +209,12 @@
         reached += unitVector;
         // Check if any of the shapes points collide
         for (uint64_t i = 0; i < shape.size(); i++) {
-            if (world.collides(reached+shape[i])) {  // Collision
+            if (world.terrain.collides(reached+shape[i])) {  // Collision
 
                 collisionPoint = reached+shape[i];
 
                 if (inAir)
-                    this->bounce(world.getNormal(reached + shape[i], reached - unitVector + shape[i]));
+                    this->bounce(world.terrain.getNormal(reached + shape[i], reached - unitVector + shape[i]));
 
                 reached = reached - unitVector; // Return to last point
                 collided = true;
@@ -355,7 +355,7 @@
 }
     
 PixelCoordinate PhysicsObject::getCoordinate (void) const {
-    return world.getPixelCoordinate(position);
+    return world.terrain.getPixelCoordinate(position);
 }
 
 Vector PhysicsObject::getVelocity (void) const {