Robot's source code

Dependencies:   mbed

Revision:
117:f8c147141a0c
Parent:
109:53918ba98306
Child:
119:c45efcd706d9
diff -r c88c058ced64 -r f8c147141a0c Map/Map.cpp
--- a/Map/Map.cpp	Wed May 06 06:51:49 2015 +0000
+++ b/Map/Map.cpp	Wed May 06 11:22:17 2015 +0000
@@ -71,6 +71,7 @@
     
     
     unsigned int i=0;
+    unsigned int instanceDePoint=0;
     
     std::vector<Point*> openList;
     openList.push_back(new Point(x/mpc,y/mpc));
@@ -112,7 +113,8 @@
                 if(dx==0 && dy==0) continue;
                 
                 Point *p = new Point(current->getx()+dx,current->gety()+dy);
-                if(p == 0) // Overload !!!
+                instanceDePoint++;
+                if(p == 0 || instanceDePoint >= MAXPOINT) // Overload !!!
                 {
                     for(unsigned int i=0;i<openList.size();i++)
                         delete openList[i];