gfoo
authorekku
Mon, 01 Dec 2008 22:32:58 +0000
changeset 164 1d4772967cd0
parent 163 e3db8a0bb89f
child 165 26e6a87a9085
gfoo
src/proto2/Physics.cc
src/proto2/Terrain.cc
--- a/src/proto2/Physics.cc	Mon Dec 01 22:24:17 2008 +0000
+++ b/src/proto2/Physics.cc	Mon Dec 01 22:32:58 2008 +0000
@@ -49,14 +49,15 @@
     //for(int steps = 0; steps < 3; steps++) {
     
     // Go up but not if the wall is over two pixels
-    if(world.getType(cursor) != EMPTY) {
+    if(world.collides(cursor)) {
+   
         for(int height = 0, max = 2; height < max+42; height++) {
             
             if(height >= max)
                 return reached;
             
             cursor.y--;
-            if(world.getType(cursor) == EMPTY) {
+            if(!world.collides(cursor)) {
                 // Check that the other parts of the worm don't collide with anything
                 if(possibleLocation(cursor)) {
                     reached = cursor - shape[2];
@@ -87,7 +88,7 @@
             }
             
             cursor.y++;
-            if(world.getType(cursor) == EMPTY) {
+            if(!world.collides(cursor)) {
                 // Check that the other parts of the worm don't collide with anything
                 if(possibleLocation(cursor)) {
                     reached = cursor - shape[2];
--- a/src/proto2/Terrain.cc	Mon Dec 01 22:24:17 2008 +0000
+++ b/src/proto2/Terrain.cc	Mon Dec 01 22:32:58 2008 +0000
@@ -47,7 +47,7 @@
 }
 
 uint16_t Terrain::scale(float x) const {
-    return (uint16_t)round(x/MAP_SCALE);
+    return (uint16_t)(x/MAP_SCALE);
 }
 
 TerrainType Terrain::getType(int32_t x, int32_t y) const {