* This function looks at the vehicle and updates its speed (cur_speed * and subspeed) variables. Furthermore, it returns the distance that * the train can drive this tick. #Vehicle::GetAdvanceDistance() determines * the distance to drive before moving a step on the map. * @return distance to drive. */
| 3017 | * @return distance to drive. |
| 3018 | */ |
| 3019 | int Train::UpdateSpeed() |
| 3020 | { |
| 3021 | switch (_settings_game.vehicle.train_acceleration_model) { |
| 3022 | default: NOT_REACHED(); |
| 3023 | case AM_ORIGINAL: |
| 3024 | return this->DoUpdateSpeed(this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2), 0, this->GetCurrentMaxSpeed()); |
| 3025 | |
| 3026 | case AM_REALISTIC: |
| 3027 | return this->DoUpdateSpeed(this->GetAcceleration(), this->GetAccelerationStatus() == AS_BRAKE ? 0 : 2, this->GetCurrentMaxSpeed()); |
| 3028 | } |
| 3029 | } |
| 3030 | |
| 3031 | /** |
| 3032 | * Trains enters a station, send out a news item if it is the first train, and start loading. |
no test coverage detected