Fix an uninitialized value valgrind warning.
This commit is contained in:
parent
be30c2d53b
commit
9626805a09
2 changed files with 13 additions and 7 deletions
|
@ -57,6 +57,7 @@ void FGAICarrier::readFromScenario(SGPropertyNode* scFileNode) {
|
||||||
setMaxLong(scFileNode->getDoubleValue("max-long", 0));
|
setMaxLong(scFileNode->getDoubleValue("max-long", 0));
|
||||||
setMinLong(scFileNode->getDoubleValue("min-long", 0));
|
setMinLong(scFileNode->getDoubleValue("min-long", 0));
|
||||||
setMPControl(scFileNode->getBoolValue("mp-control", false));
|
setMPControl(scFileNode->getBoolValue("mp-control", false));
|
||||||
|
setAIControl(scFileNode->getBoolValue("ai-control", false));
|
||||||
|
|
||||||
SGPropertyNode* flols = scFileNode->getChild("flols-pos");
|
SGPropertyNode* flols = scFileNode->getChild("flols-pos");
|
||||||
if (flols) {
|
if (flols) {
|
||||||
|
@ -121,6 +122,10 @@ void FGAICarrier::setMPControl(bool c) {
|
||||||
MPControl = c;
|
MPControl = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FGAICarrier::setAIControl(bool c) {
|
||||||
|
AIControl = c;
|
||||||
|
}
|
||||||
|
|
||||||
void FGAICarrier::update(double dt) {
|
void FGAICarrier::update(double dt) {
|
||||||
// Now update the position and heading. This will compute new hdg and
|
// Now update the position and heading. This will compute new hdg and
|
||||||
// roll values required for the rotation speed computation.
|
// roll values required for the rotation speed computation.
|
||||||
|
@ -134,8 +139,8 @@ void FGAICarrier::update(double dt) {
|
||||||
TurnToLaunch();
|
TurnToLaunch();
|
||||||
} else if(turn_to_recovery_hdg ){
|
} else if(turn_to_recovery_hdg ){
|
||||||
TurnToRecover();
|
TurnToRecover();
|
||||||
} else if(OutsideBox() || returning ) {// check that the carrier is inside
|
} else if(OutsideBox() || returning ) {// check that the carrier is inside
|
||||||
ReturnToBox(); // the operating box,
|
ReturnToBox(); // the operating box,
|
||||||
} else {
|
} else {
|
||||||
TurnToBase();
|
TurnToBase();
|
||||||
}
|
}
|
||||||
|
@ -168,10 +173,10 @@ void FGAICarrier::update(double dt) {
|
||||||
eyeWrtCarrier = ec2body.transform(eyeWrtCarrier);
|
eyeWrtCarrier = ec2body.transform(eyeWrtCarrier);
|
||||||
// the eyepoints vector wrt the flols position
|
// the eyepoints vector wrt the flols position
|
||||||
SGVec3d eyeWrtFlols = eyeWrtCarrier - flols_off;
|
SGVec3d eyeWrtFlols = eyeWrtCarrier - flols_off;
|
||||||
|
|
||||||
// the distance from the eyepoint to the flols
|
// the distance from the eyepoint to the flols
|
||||||
dist = norm(eyeWrtFlols);
|
dist = norm(eyeWrtFlols);
|
||||||
|
|
||||||
// now the angle, positive angles are upwards
|
// now the angle, positive angles are upwards
|
||||||
if (fabs(dist) < SGLimits<float>::min()) {
|
if (fabs(dist) < SGLimits<float>::min()) {
|
||||||
angle = 0;
|
angle = 0;
|
||||||
|
@ -180,7 +185,7 @@ void FGAICarrier::update(double dt) {
|
||||||
sAngle = SGMiscd::min(1, SGMiscd::max(-1, sAngle));
|
sAngle = SGMiscd::min(1, SGMiscd::max(-1, sAngle));
|
||||||
angle = SGMiscd::rad2deg(asin(sAngle));
|
angle = SGMiscd::rad2deg(asin(sAngle));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the value of source
|
// set the value of source
|
||||||
if ( angle <= 4.35 && angle > 4.01 )
|
if ( angle <= 4.35 && angle > 4.01 )
|
||||||
source = 1;
|
source = 1;
|
||||||
|
@ -436,12 +441,12 @@ void FGAICarrier::TurnToRecover(){
|
||||||
if (wind_speed_kts < 3){
|
if (wind_speed_kts < 3){
|
||||||
tgt_heading = base_course + 60;
|
tgt_heading = base_course + 60;
|
||||||
} else if (rel_wind < -9 && rel_wind >= -180){
|
} else if (rel_wind < -9 && rel_wind >= -180){
|
||||||
tgt_heading = wind_from_deg;
|
tgt_heading = wind_from_deg;
|
||||||
} else if (rel_wind > -7 && rel_wind < 45){
|
} else if (rel_wind > -7 && rel_wind < 45){
|
||||||
tgt_heading = wind_from_deg + 60;
|
tgt_heading = wind_from_deg + 60;
|
||||||
} else if (rel_wind >=45 && rel_wind < 180){
|
} else if (rel_wind >=45 && rel_wind < 180){
|
||||||
tgt_heading = wind_from_deg + 45;
|
tgt_heading = wind_from_deg + 45;
|
||||||
} else
|
} else
|
||||||
tgt_heading = hdg;
|
tgt_heading = hdg;
|
||||||
|
|
||||||
SG_NORMALIZE_RANGE(tgt_heading, 0.0, 360.0);
|
SG_NORMALIZE_RANGE(tgt_heading, 0.0, 360.0);
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
void setMaxLong( double deg );
|
void setMaxLong( double deg );
|
||||||
void setMinLong( double deg );
|
void setMinLong( double deg );
|
||||||
void setMPControl( bool c );
|
void setMPControl( bool c );
|
||||||
|
void setAIControl( bool c );
|
||||||
void TurnToLaunch();
|
void TurnToLaunch();
|
||||||
void TurnToRecover();
|
void TurnToRecover();
|
||||||
void TurnToBase();
|
void TurnToBase();
|
||||||
|
|
Loading…
Add table
Reference in a new issue