]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
map: Fixed detection of free obstacles
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 24 Apr 2009 22:22:46 +0000 (00:22 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 24 Apr 2009 22:26:34 +0000 (00:26 +0200)
src/pathplan/map.c
src/robomon/RobomonAtlantis.cpp

index 87a22ae1d43f6158e508db3e4948534537038abf..53544581b7051fd258f2622b681ff85619941149 100644 (file)
@@ -151,9 +151,13 @@ struct map_cell *ShmapCellAtPoint(double x_m, double y_m)
 int ShmapIsFreeCell(int x, int y)
 {
         struct map_cell *cell;
-        if(map && ShmapIsCellInMap(x,y)) {        
+        if(map && ShmapIsCellInMap(x,y)) {
+               bool free;
                 cell = &(map->cells[y][x]);
-                return (cell->detected_obstacle == 0) && ((cell->flags & ((MAP_FLAG_WALL&~MAP_FLAG_INVALIDATE_WALL)|MAP_FLAG_DET_OBST|MAP_FLAG_PLAN_MARGIN)) == 0);
+                free = (cell->detected_obstacle == 0) &&
+                       (((cell->flags & (MAP_FLAG_WALL|MAP_FLAG_DET_OBST|MAP_FLAG_PLAN_MARGIN)) == 0) ||
+                        ((cell->flags & MAP_FLAG_WALL) && (cell->flags & MAP_FLAG_INVALIDATE_WALL)));
+               return free;
         }
         else return -1;
 }
@@ -179,7 +183,6 @@ int ShmapIsFreePoint(double x_m, double y_m)
 int ShmapSetCircleFlag(double xs, double ys, double r, map_cell_flag_t set_flags, map_cell_flag_t clear_flags)
 {
        int i,j, i1, i2, j1, j2;
-       bool valid;
 
        // define a circumscribe square - just to shorten cyclic pass through the playground
         //ShmapPoint2Cell(xs-r, ys-r, &i1, &j1, &valid);
index 539634466f184faa0a2df8506435d05be6753191..388b3535da90a98f80303d8dcb938a2e76ab1876 100644 (file)
@@ -607,7 +607,6 @@ void RobomonAtlantis::showPlayground()
 void RobomonAtlantis::paintMap()
 {
        using namespace Qt;
-       int x, y;
         struct map *map = ShmapIsMapInit();
 
         if (!map) return;