]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
First check if parked then car heading
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 16 Jul 2021 13:47:57 +0000 (15:47 +0200)
committerJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 20 Jul 2021 14:49:17 +0000 (16:49 +0200)
src/pslot.cc

index 5a4f1352d573feb288fb988c6d47f4cf89b710a9..f3ea854d51033c4c0c1f06022231a272c47c5966 100644 (file)
@@ -152,15 +152,15 @@ ParkingSlot::drive_in_slot(BicycleCar c, unsigned int& max)
        path.push_back(c);
        unsigned int cusp = 0;
        while (cusp < max) {
-               if (c.h() < this->h()) {
-                       return std::vector<BicycleCar>();
-               }
                if (this->parked(c)) {
                        if (cusp < max) {
                                max = cusp;
                        }
                        break;
                }
+               if (c.h() < this->h()) {
+                       return std::vector<BicycleCar>();
+               }
                c.next();
                if (this->collide(c)) {
                        c.sp(c.sp() * -1.0);