* This function looks at the vehicle and updates its speed (cur_speed * and subspeed) variables. Furthermore, it returns the distance that * the vehicle can drive this tick. #Vehicle::GetAdvanceDistance() determines * the distance to drive before moving a step on the map. * @return distance to drive. */
| 737 | * @return distance to drive. |
| 738 | */ |
| 739 | int RoadVehicle::UpdateSpeed() |
| 740 | { |
| 741 | switch (_settings_game.vehicle.roadveh_acceleration_model) { |
| 742 | default: NOT_REACHED(); |
| 743 | case AM_ORIGINAL: |
| 744 | return this->DoUpdateSpeed(this->overtaking != 0 ? 512 : 256, 0, this->GetCurrentMaxSpeed()); |
| 745 | |
| 746 | case AM_REALISTIC: |
| 747 | return this->DoUpdateSpeed(this->GetAcceleration() + (this->overtaking != 0 ? 256 : 0), this->GetAccelerationStatus() == AS_BRAKE ? 0 : 4, this->GetCurrentMaxSpeed()); |
| 748 | } |
| 749 | } |
| 750 | |
| 751 | static Direction RoadVehGetNewDirection(const RoadVehicle *v, int x, int y) |
| 752 | { |
no test coverage detected