De-boost-ify position-init code
Also remove some now redundant parking-availability code, which is now covered inside the dynamics code.
This commit is contained in:
parent
a8e1fd4fd0
commit
06d206828a
1 changed files with 8 additions and 15 deletions
|
@ -16,13 +16,10 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include "positioninit.hxx"
|
#include "positioninit.hxx"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <osg/PagedLOD>
|
#include <osg/PagedLOD>
|
||||||
|
|
||||||
|
@ -178,7 +175,7 @@ static void fgApplyStartOffset(const SGGeod& aStartPos, double aHeading, double
|
||||||
setInitialPosition(startPos, aHeading);
|
setInitialPosition(startPos, aHeading);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::tuple<SGGeod, double> runwayStartPos(FGRunwayRef runway)
|
std::tuple<SGGeod, double> runwayStartPos(FGRunwayRef runway)
|
||||||
{
|
{
|
||||||
fgSetString("/sim/atc/runway", runway->ident().c_str());
|
fgSetString("/sim/atc/runway", runway->ident().c_str());
|
||||||
double offsetNm = fgGetDouble("/sim/presets/offset-distance-nm");
|
double offsetNm = fgGetDouble("/sim/presets/offset-distance-nm");
|
||||||
|
@ -197,14 +194,14 @@ boost::tuple<SGGeod, double> runwayStartPos(FGRunwayRef runway)
|
||||||
if (taxiNode) {
|
if (taxiNode) {
|
||||||
// set this so multiplayer.nas can inform the user
|
// set this so multiplayer.nas can inform the user
|
||||||
fgSetBool("/sim/presets/avoided-mp-runway", true);
|
fgSetBool("/sim/presets/avoided-mp-runway", true);
|
||||||
return boost::make_tuple(taxiNode->geod(), SGGeodesy::courseDeg(taxiNode->geod(), pos));
|
return std::make_tuple(taxiNode->geod(), SGGeodesy::courseDeg(taxiNode->geod(), pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we couldn't find a suitable taxi-node, give up. Guessing a position
|
// if we couldn't find a suitable taxi-node, give up. Guessing a position
|
||||||
// causes too much pain (starting in the water or similar bad things)
|
// causes too much pain (starting in the water or similar bad things)
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::make_tuple(pos, runway->headingDeg());
|
return std::make_tuple(pos, runway->headingDeg());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current_options lon/lat given an airport id and heading (degrees)
|
// Set current_options lon/lat given an airport id and heading (degrees)
|
||||||
|
@ -230,7 +227,7 @@ static bool setPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FGRunway* r = apt->findBestRunwayForHeading(tgt_hdg);
|
FGRunway* r = apt->findBestRunwayForHeading(tgt_hdg);
|
||||||
boost::tie(startPos, heading) = runwayStartPos(r);
|
std::tie(startPos, heading) = runwayStartPos(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
fgApplyStartOffset(startPos, heading);
|
fgApplyStartOffset(startPos, heading);
|
||||||
|
@ -317,11 +314,7 @@ static bool fgSetPosFromAirportIDandParkpos( const string& id, const string& par
|
||||||
// Why is the following line necessary?
|
// Why is the following line necessary?
|
||||||
fgGetString("/sim/presets/parkpos");
|
fgGetString("/sim/presets/parkpos");
|
||||||
fgSetString("/sim/presets/parkpos", pka.parking()->getName());
|
fgSetString("/sim/presets/parkpos", pka.parking()->getName());
|
||||||
// The problem is, this line doesn't work because the ParkingAssignment's refcounting mechanism:
|
|
||||||
// The parking will be released after this function returns.
|
|
||||||
// As a temporary measure, I'll try to reserve the parking via the atc_manager, which should work, because it uses the same
|
|
||||||
// mechanism as the AI traffic code.
|
|
||||||
dcs->setParkingAvailable(pka.parking(), false);
|
|
||||||
fgApplyStartOffset(pka.parking()->geod(), pka.parking()->getHeading());
|
fgApplyStartOffset(pka.parking()->geod(), pka.parking()->getHeading());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +340,7 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bo
|
||||||
FGRunway* r(apt->getRunwayByIdent(rwy));
|
FGRunway* r(apt->getRunwayByIdent(rwy));
|
||||||
SGGeod startPos;
|
SGGeod startPos;
|
||||||
double heading;
|
double heading;
|
||||||
boost::tie(startPos, heading) = runwayStartPos(r);
|
std::tie(startPos, heading) = runwayStartPos(r);
|
||||||
fgApplyStartOffset(startPos, heading);
|
fgApplyStartOffset(startPos, heading);
|
||||||
return true;
|
return true;
|
||||||
} else if (apt->hasHelipadWithIdent(rwy)) {
|
} else if (apt->hasHelipadWithIdent(rwy)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue