This commit is contained in:
aozhiwei 2021-05-06 19:52:23 +08:00
parent 09b43289aa
commit 6dfb5b26ef
3 changed files with 12 additions and 1 deletions

View File

@ -197,3 +197,9 @@ float Car::GetRadius()
abort();
return 0;
}
float Car::GetSpeed()
{
float speed = hero_meta_->i->move_speed();
return speed;
}

View File

@ -30,6 +30,7 @@ class Car : public Creature
void GetOn(Human* passenger);
void SyncPos();
virtual float GetRadius() override;
virtual float GetSpeed() override;
private:
int AllocSeat();

View File

@ -164,7 +164,11 @@ void Player::UpdateMove()
moved_frames = 0;
return;
}
_UpdateMove(std::max(1, (int)GetSpeed()));
if (GetCar() && GetCar()->IsDriver(this)) {
_UpdateMove(std::max(1, (int)GetCar()->GetSpeed()));
} else {
_UpdateMove(std::max(1, (int)GetSpeed()));
}
if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) {
SetLastCollisionDoor(nullptr);
}