From: Jiri Vlasak Date: Fri, 16 Jul 2021 13:47:57 +0000 (+0200) Subject: First check if parked then car heading X-Git-Tag: v0.6.0~3^2~16 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/bcar.git/commitdiff_plain/337d0f12aee350641bfbb9b0fe40c9b0ab3fb788?ds=sidebyside First check if parked then car heading --- diff --git a/src/pslot.cc b/src/pslot.cc index 5a4f135..f3ea854 100644 --- a/src/pslot.cc +++ b/src/pslot.cc @@ -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(); - } if (this->parked(c)) { if (cusp < max) { max = cusp; } break; } + if (c.h() < this->h()) { + return std::vector(); + } c.next(); if (this->collide(c)) { c.sp(c.sp() * -1.0);