src/AIModel/: fixed some compiler warnings
src/AIModel/AICarrier.cxx Avoid warning about unused angle_tdp variable. src/AIModel/AIFlightPlanCreate.cxx Increased a buffer size that was giving warning with snprintf(). Also always use sizeof(buffer) instead of duplicating the explicit size.
This commit is contained in:
parent
05cb7fc2be
commit
77c362a9d4
2 changed files with 8 additions and 8 deletions
|
@ -268,16 +268,16 @@ void FGAICarrier::update(double dt) {
|
||||||
|
|
||||||
// the distance from the eyepoint to the flols
|
// the distance from the eyepoint to the flols
|
||||||
double dist_tdp = norm(eyeWrtFlols_tdp);
|
double dist_tdp = norm(eyeWrtFlols_tdp);
|
||||||
double angle_tdp = 0;
|
//double angle_tdp = 0;
|
||||||
|
|
||||||
// now the angle, positive angles are upwards
|
// now the angle, positive angles are upwards
|
||||||
if (fabs(dist_tdp) < SGLimits<double>::min()) {
|
if (fabs(dist_tdp) < SGLimits<double>::min()) {
|
||||||
angle_tdp = 0;
|
//angle_tdp = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
double sAngle = -eyeWrtFlols_tdp(2) / dist_tdp;
|
double sAngle = -eyeWrtFlols_tdp(2) / dist_tdp;
|
||||||
sAngle = SGMiscd::min(1, SGMiscd::max(-1, sAngle));
|
sAngle = SGMiscd::min(1, SGMiscd::max(-1, sAngle));
|
||||||
angle_tdp = SGMiscd::rad2deg(asin(sAngle));
|
//angle_tdp = SGMiscd::rad2deg(asin(sAngle));
|
||||||
}
|
}
|
||||||
// printf("angle %5.2f td angle %5.2f \n", _flols_angle, angle_tdp);
|
// printf("angle %5.2f td angle %5.2f \n", _flols_angle, angle_tdp);
|
||||||
//angle += 1.481; // adjust for FLOLS offset (measured on Nimitz class)
|
//angle += 1.481; // adjust for FLOLS offset (measured on Nimitz class)
|
||||||
|
|
|
@ -369,7 +369,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
||||||
// These can probably be generated on the fly however.
|
// These can probably be generated on the fly however.
|
||||||
while (taxiRoute.next(node, &route)) {
|
while (taxiRoute.next(node, &route)) {
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
snprintf(buffer, 10, "%d", node->getIndex());
|
snprintf(buffer, sizeof(buffer), "%d", node->getIndex());
|
||||||
FGAIWaypoint *wpt =
|
FGAIWaypoint *wpt =
|
||||||
createOnGround(ac, buffer, node->geod(), apt->getElevation(),
|
createOnGround(ac, buffer, node->geod(), apt->getElevation(),
|
||||||
ac->getPerformance()->vTaxi());
|
ac->getPerformance()->vTaxi());
|
||||||
|
@ -871,7 +871,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
|
||||||
double currentDist = i * (newDistance / nPoints);
|
double currentDist = i * (newDistance / nPoints);
|
||||||
double currentAltitude = alt - (i * (dAlt / nPoints));
|
double currentAltitude = alt - (i * (dAlt / nPoints));
|
||||||
SGGeodesy::direct(origin, azimuth, currentDist, result, dummyAz2);
|
SGGeodesy::direct(origin, azimuth, currentDist, result, dummyAz2);
|
||||||
snprintf(buffer, 16, "descent%03d", i);
|
snprintf(buffer, sizeof(buffer), "descent%03d", i);
|
||||||
wpt = createInAir(ac, buffer, result, currentAltitude, vDescent);
|
wpt = createInAir(ac, buffer, result, currentAltitude, vDescent);
|
||||||
wpt->setCrossat(currentAltitude);
|
wpt->setCrossat(currentAltitude);
|
||||||
wpt->setTrackLength((newDistance / nPoints));
|
wpt->setTrackLength((newDistance / nPoints));
|
||||||
|
@ -923,7 +923,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
|
||||||
|
|
||||||
SGGeodesy::direct(secondaryTarget, i,
|
SGGeodesy::direct(secondaryTarget, i,
|
||||||
initialTurnRadius, result, dummyAz2);
|
initialTurnRadius, result, dummyAz2);
|
||||||
snprintf(buffer, 16, "turn%03d", i);
|
snprintf(buffer, sizeof(buffer), "turn%03d", i);
|
||||||
wpt = createInAir(ac, buffer, result, currentAltitude, vDescent);
|
wpt = createInAir(ac, buffer, result, currentAltitude, vDescent);
|
||||||
wpt->setCrossat(currentAltitude);
|
wpt->setCrossat(currentAltitude);
|
||||||
wpt->setTrackLength(trackLength);
|
wpt->setTrackLength(trackLength);
|
||||||
|
@ -1011,7 +1011,7 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt,
|
||||||
double vTaxiMetric = vTaxi * SG_KT_TO_MPS;
|
double vTaxiMetric = vTaxi * SG_KT_TO_MPS;
|
||||||
double decelMetric = decel * SG_KT_TO_MPS;
|
double decelMetric = decel * SG_KT_TO_MPS;
|
||||||
|
|
||||||
char buffer[12];
|
char buffer[20];
|
||||||
if (!apt->hasRunwayWithIdent(activeRunway)) {
|
if (!apt->hasRunwayWithIdent(activeRunway)) {
|
||||||
SG_LOG(SG_AI, SG_WARN, "FGAIFlightPlan::createLanding: No such runway " << activeRunway << " at " << apt->ident());
|
SG_LOG(SG_AI, SG_WARN, "FGAIFlightPlan::createLanding: No such runway " << activeRunway << " at " << apt->ident());
|
||||||
return false;
|
return false;
|
||||||
|
@ -1065,7 +1065,7 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt,
|
||||||
|
|
||||||
int nPoints = (int)(rolloutDistance/30);
|
int nPoints = (int)(rolloutDistance/30);
|
||||||
for (int i = 1; i < nPoints; i++) {
|
for (int i = 1; i < nPoints; i++) {
|
||||||
snprintf(buffer, 12, "landing%03d", i);
|
snprintf(buffer, sizeof(buffer), "landing%03d", i);
|
||||||
double t = ((double) i) / nPoints;
|
double t = ((double) i) / nPoints;
|
||||||
coord = rwy->pointOnCenterline(touchdownDistance + (rolloutDistance * t));
|
coord = rwy->pointOnCenterline(touchdownDistance + (rolloutDistance * t));
|
||||||
double vel = (vTouchdownMetric * (1.0 - t)) + (vTaxiMetric * t);
|
double vel = (vTouchdownMetric * (1.0 - t)) + (vTaxiMetric * t);
|
||||||
|
|
Loading…
Add table
Reference in a new issue