车可以开进停车场
This commit is contained in:
1 parent
0dc9ec1aa7
commit
94c100ee65
2 files changed
+7
-1
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#include "car.h"
|
||||
#include "logwindow.h"
|
||||
|
||||
|
||||
Car::Car(ParkingLotManager * manager, QGraphicsItem *parent, int dir, Car::Color color) :
|
||||
@@ -88,6 +89,7 @@ void Car::setPath(Path *path)
|
||||
m_path = path;
|
||||
m_target = path->getNext();
|
||||
m_current = m_target;
|
||||
m_target.action = Road::none;
|
||||
this->setPos(m_target.point);
|
||||
|
||||
}
|
||||
@@ -124,15 +126,19 @@ void Car::followPath()
|
||||
switch (m_target.action)
|
||||
{
|
||||
case Road::entry :
|
||||
Log::i("发送entry信号");
|
||||
emit entry(this);
|
||||
break;
|
||||
case Road::stair:
|
||||
Log::i("发送楼梯信号");
|
||||
emit stair(this);
|
||||
break;
|
||||
case Road::exit:
|
||||
Log::i("发送离开信号");
|
||||
emit exit(this);
|
||||
break;
|
||||
case Road::queueHead:
|
||||
Log::i("发送请求车位信号");
|
||||
emit queueHead(this);
|
||||
break;
|
||||
case Road::none:
|
||||
|
||||
@@ -153,7 +153,7 @@ void ParkingLotManager::requestIn(Car* car)
|
||||
car->setFloor(l);
|
||||
car->setNum(n);
|
||||
car->followPath();
|
||||
Log::i(QString("分配第") + l + "层" + n + "号车位,剩余" + QString::number(m_pool.size()) + "个空车位");
|
||||
Log::i(QString("分配第%1层%2号车位,剩余%3个空车位").arg(l).arg(n).arg(m_pool.size()));
|
||||
} else {
|
||||
Log::i("请求失败,车位已满");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user