1
This commit is contained in:
parent
2bf334dbfd
commit
4387cece7b
@ -158,3 +158,18 @@ int Car::AllocSeat()
|
|||||||
}
|
}
|
||||||
return seat;
|
return seat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Car::SyncPos()
|
||||||
|
{
|
||||||
|
if (driver_) {
|
||||||
|
SetPos(driver_->GetPos());
|
||||||
|
move_dir = driver_->move_dir;
|
||||||
|
for (auto hum : passengers_) {
|
||||||
|
if (hum != driver_) {
|
||||||
|
hum->SetPos(GetPos());
|
||||||
|
hum->move_dir = move_dir;
|
||||||
|
room->grid_service->MoveHuman(hum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -27,6 +27,7 @@ class Car : public MoveableEntity
|
|||||||
bool IsDriver(Human* hum) { return driver_ == hum && driver_; }
|
bool IsDriver(Human* hum) { return driver_ == hum && driver_; }
|
||||||
void GetDown(Human* passenger);
|
void GetDown(Human* passenger);
|
||||||
void GetOn(Human* passenger);
|
void GetOn(Human* passenger);
|
||||||
|
void SyncPos();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int AllocSeat();
|
int AllocSeat();
|
||||||
|
@ -148,6 +148,9 @@ void Player::UpdateMove()
|
|||||||
if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) {
|
if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) {
|
||||||
SetLastCollisionDoor(nullptr);
|
SetLastCollisionDoor(nullptr);
|
||||||
}
|
}
|
||||||
|
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||||
|
GetCar()->SyncPos();
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
room->CheckPartObjects();
|
room->CheckPartObjects();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user