1
0
Fork 0

Enable the AI pilot to hit the breaks hard when necessary.

This commit is contained in:
Durk Talsma 2011-11-12 18:42:59 +01:00
parent 0905b4f367
commit 4903556bb2
2 changed files with 9 additions and 3 deletions

View file

@ -49,7 +49,7 @@ PerformanceData::PerformanceData( const std::string& filename)
PerformanceData::~PerformanceData() PerformanceData::~PerformanceData()
{} {}
double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt) { double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt, bool maxBrakes) {
// if (tgt_speed > _vTaxi & ac->onGround()) // maximum taxi speed on ground // if (tgt_speed > _vTaxi & ac->onGround()) // maximum taxi speed on ground
// tgt_speed = _vTaxi; // tgt_speed = _vTaxi;
// bad idea for a take off roll :-) // bad idea for a take off roll :-)
@ -66,7 +66,13 @@ double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double d
} else if (speed_diff < 0.0) { // decelerate } else if (speed_diff < 0.0) { // decelerate
if (ac->onGround()) { if (ac->onGround()) {
// deceleration performance is better due to wheel brakes. // deceleration performance is better due to wheel brakes.
speed -= BRAKE_SETTING * _deceleration * dt; double brakePower = 0;
if (maxBrakes) {
brakePower = 3;
} else {
brakePower = BRAKE_SETTING;
}
speed -= brakePower * _deceleration * dt;
} else { } else {
speed -= _deceleration * dt; speed -= _deceleration * dt;
} }

View file

@ -29,7 +29,7 @@ public:
PerformanceData(const std::string& filename); PerformanceData(const std::string& filename);
~PerformanceData(); ~PerformanceData();
double actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt); double actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt, bool needMaxBrake);
double actualBankAngle(FGAIAircraft* ac, double tgt_roll, double dt); double actualBankAngle(FGAIAircraft* ac, double tgt_roll, double dt);
double actualPitch(FGAIAircraft* ac, double tgt_pitch, double dt); double actualPitch(FGAIAircraft* ac, double tgt_pitch, double dt);
double actualHeading(FGAIAircraft* ac, double tgt_heading, double dt); double actualHeading(FGAIAircraft* ac, double tgt_heading, double dt);