]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Fix drive in slot method
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 19 Jul 2021 07:56:36 +0000 (09:56 +0200)
committerJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 20 Jul 2021 14:49:17 +0000 (16:49 +0200)
src/pslot.cc

index 714d39dc57591a722225d2c2469127d08f09ac35..a10b17cb74bda952917cafb416299b50f5b3cf53 100644 (file)
@@ -151,12 +151,13 @@ ParkingSlot::drive_in_slot(BicycleCar c, unsigned int& max)
        path.reserve(max + 2);
        path.push_back(c);
        unsigned int cusp = 0;
-       while (cusp < max) {
+       while (cusp < max + 1) {
                if (this->parked(c)) {
                        if (cusp < max) {
                                max = cusp;
                        }
-                       break;
+                       path.push_back(c);
+                       return path;
                }
                if (c.h() < this->h()) {
                        return std::vector<BicycleCar>();
@@ -170,8 +171,7 @@ ParkingSlot::drive_in_slot(BicycleCar c, unsigned int& max)
                        cusp += 1;
                }
        }
-       path.push_back(c);
-       return path;
+       return std::vector<BicycleCar>();
 }
 
 PoseRange