diff --git a/car.cpp b/car.cpp index 160b983..8b90720 100644 --- a/car.cpp +++ b/car.cpp @@ -98,7 +98,8 @@ void Car::setPath(Path *path) m_target.point = m_target.point - QPoint(20, 30); m_current = m_target; m_target.action = Road::none; - this->setPos(m_target.point); + + this->setPos(m_target.point - 0.5*QPoint(M_WID, M_LEN)); this->setRotation(m_target.dir+90); } @@ -148,8 +149,8 @@ void Car::followPath() break; case Road::queueHead: Log::i("发送请求车位信号"); - // emit queueHead(this); - emit back(this); + emit queueHead(this); + // emit back(this); break; case Road::none: break; diff --git a/parkingLotManager.cpp b/parkingLotManager.cpp index bfda235..1eb78a2 100644 --- a/parkingLotManager.cpp +++ b/parkingLotManager.cpp @@ -60,7 +60,7 @@ ParkingLotManager::ParkingLotManager(QObject* objectParent, QGraphicsScene* scen QTimer *timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &ParkingLotManager::periodWork); - // timer->start(1000); // 轮询 + timer->start(1000); // 轮询 } void ParkingLotManager::showParkingLot(uint pos) @@ -216,7 +216,7 @@ void ParkingLotManager::requestIn(Car* car) if (!m_pool.empty()) { uint l = m_pool.first().first; int n = m_pool.first().second + 1; - l = 0; + // l = 0; m_pool.removeAt(0); Log::i(QString("分配第%1层%2号车位,剩余%3个空车位").arg(l).arg(n).arg(m_pool.size())); Path* p;