1
This commit is contained in:
parent
2bf334dbfd
commit
4387cece7b
@ -158,3 +158,18 @@ int Car::AllocSeat()
|
||||
}
|
||||
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_; }
|
||||
void GetDown(Human* passenger);
|
||||
void GetOn(Human* passenger);
|
||||
void SyncPos();
|
||||
|
||||
private:
|
||||
int AllocSeat();
|
||||
|
@ -148,6 +148,9 @@ void Player::UpdateMove()
|
||||
if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) {
|
||||
SetLastCollisionDoor(nullptr);
|
||||
}
|
||||
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||
GetCar()->SyncPos();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
room->CheckPartObjects();
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user