Enable the AI pilot to hit the breaks hard when necessary.
This commit is contained in:
parent
0905b4f367
commit
4903556bb2
2 changed files with 9 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue