]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
robofsm: Target detection
authorMichal Vokac <vokac.m@gmail.com>
Fri, 16 Dec 2011 18:08:23 +0000 (19:08 +0100)
committerMichal Vokac <vokac.m@gmail.com>
Mon, 1 Oct 2012 17:29:29 +0000 (19:29 +0200)
Do not return true when target detected but out of range!
Simply return number of detected targets inside playground.

src/robofsm/common-states.cc

index cf91372bdabde828cd4395b7b5472e3fb5d3d93c..d401f5e8ae6edc055ea80d131a63cfd146d458b9 100644 (file)
@@ -125,10 +125,8 @@ static bool detect_target()
                         if (goal_is_in_playground(target.x, target.y))
                                 detected_target.push_back(target);
                 }
-                return true;
-        } else {
-                return false;
         }
+        return detected_target.size();
 }
 
 /**