Fix issues exposed by PLIB-free SimGear.
This commit is contained in:
parent
bf52c378a4
commit
900fce6374
4 changed files with 17 additions and 37 deletions
|
@ -175,20 +175,12 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIAircraft *ac,
|
||||||
if (wpt->name == "END") wpt->finished = true;
|
if (wpt->name == "END") wpt->finished = true;
|
||||||
else wpt->finished = false;
|
else wpt->finished = false;
|
||||||
waypoints.push_back(wpt);
|
waypoints.push_back(wpt);
|
||||||
}
|
} // of node loop
|
||||||
}
|
} catch (const sg_exception &e) {
|
||||||
catch (const sg_exception &) {
|
SG_LOG(SG_GENERAL, SG_WARN, "Error reading AI flight plan: " <<
|
||||||
SG_LOG(SG_GENERAL, SG_WARN,
|
e.getMessage() << " from " << e.getOrigin());
|
||||||
"Error reading AI flight plan: ");
|
|
||||||
cerr << "Errno = " << errno << endl;
|
|
||||||
if (errno == ENOENT)
|
|
||||||
{
|
|
||||||
SG_LOG(SG_GENERAL, SG_WARN, "Reason: No such file or directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
// cout << path.str() << endl;
|
// cout << path.str() << endl;
|
||||||
// cout << "Trying to create this plan dynamically" << endl;
|
// cout << "Trying to create this plan dynamically" << endl;
|
||||||
// cout << "Route from " << dep->id << " to " << arr->id << endl;
|
// cout << "Route from " << dep->id << " to " << arr->id << endl;
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "AIAircraft.hxx"
|
#include "AIAircraft.hxx"
|
||||||
#include "performancedata.hxx"
|
#include "performancedata.hxx"
|
||||||
|
|
||||||
|
|
||||||
using std::iostream;
|
using std::iostream;
|
||||||
|
|
||||||
void FGAIFlightPlan::evaluateRoutePart(double deplat,
|
void FGAIFlightPlan::evaluateRoutePart(double deplat,
|
||||||
|
@ -55,28 +54,18 @@ void FGAIFlightPlan::evaluateRoutePart(double deplat,
|
||||||
SGGeoc arr(SGGeoc::fromDegM(arrlon, arrlat, 100.0));
|
SGGeoc arr(SGGeoc::fromDegM(arrlon, arrlat, 100.0));
|
||||||
|
|
||||||
SGVec3d a = SGVec3d::fromGeoc(dep);
|
SGVec3d a = SGVec3d::fromGeoc(dep);
|
||||||
SGVec3d b = SGVec3d::fromGeoc(arr);
|
SGVec3d nb = normalize(SGVec3d::fromGeoc(arr));
|
||||||
SGVec3d _cross = cross(b, a);
|
SGVec3d na = normalize(a);
|
||||||
|
|
||||||
|
SGVec3d _cross = cross(nb, na);
|
||||||
|
|
||||||
double angle = sgACos(dot(a, b));
|
double angle = acos(dot(na, nb));
|
||||||
|
const double angleStep = 0.05 * SG_DEGREES_TO_RADIANS;
|
||||||
tmpNode = 0;
|
tmpNode = 0;
|
||||||
for (double ang = 0.0; ang < angle; ang += 0.05)
|
for (double ang = 0.0; ang < angle; ang += angleStep)
|
||||||
{
|
{
|
||||||
sgdVec3 newPos;
|
SGQuatd q = SGQuatd::fromAngleAxis(ang, _cross);
|
||||||
sgdMat4 matrix;
|
SGGeod geod = SGGeod::fromCart(q.transform(a));
|
||||||
//cerr << "Angle = " << ang << endl;
|
|
||||||
sgdMakeRotMat4(matrix, ang, _cross.data());
|
|
||||||
for(int j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
newPos[j] =0.0;
|
|
||||||
for (int k = 0; k<3; k++)
|
|
||||||
{
|
|
||||||
newPos[j] += matrix[j][k]*a[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//cerr << "1"<< endl;
|
|
||||||
SGGeod geod = SGGeod::fromCart(SGVec3d(newPos[0], newPos[1], newPos[2]));
|
|
||||||
|
|
||||||
prevNode = tmpNode;
|
prevNode = tmpNode;
|
||||||
tmpNode = globals->get_airwaynet()->findNearestNode(geod);
|
tmpNode = globals->get_airwaynet()->findNearestNode(geod);
|
||||||
|
|
|
@ -100,8 +100,7 @@ double FGClouds::buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_
|
||||||
double y = sg_random() * SGCloudField::fieldSize - (SGCloudField::fieldSize / 2.0);
|
double y = sg_random() * SGCloudField::fieldSize - (SGCloudField::fieldSize / 2.0);
|
||||||
double z = grid_z_rand * (sg_random() - 0.5);
|
double z = grid_z_rand * (sg_random() - 0.5);
|
||||||
|
|
||||||
sgVec3 pos={x,y,z};
|
SGVec3f pos(x,y,z);
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < box_def->nChildren() ; i++) {
|
for(int i = 0; i < box_def->nChildren() ; i++) {
|
||||||
SGPropertyNode *abox = box_def->getChild(i);
|
SGPropertyNode *abox = box_def->getChild(i);
|
||||||
|
|
|
@ -190,7 +190,7 @@ FGViewMgr::bind ()
|
||||||
|
|
||||||
fgTie("/sim/current-view/view-number", this,
|
fgTie("/sim/current-view/view-number", this,
|
||||||
&FGViewMgr::getView, &FGViewMgr::setView);
|
&FGViewMgr::getView, &FGViewMgr::setView);
|
||||||
fgSetArchivable("/sim/current-view/view-number", FALSE);
|
fgSetArchivable("/sim/current-view/view-number", false);
|
||||||
|
|
||||||
fgTie("/sim/current-view/axes/long", this,
|
fgTie("/sim/current-view/axes/long", this,
|
||||||
(double_getter)0, &FGViewMgr::setViewAxisLong);
|
(double_getter)0, &FGViewMgr::setViewAxisLong);
|
||||||
|
|
Loading…
Add table
Reference in a new issue