#include <Main/fg_props.hxx>
#include <Airports/runways.hxx>
-#include STL_STRING
+#include <string>
#include <vector>
-SG_USING_STD(string);
-SG_USING_STD(vector);
-SG_USING_STD(sort);
-SG_USING_STD(random_shuffle);
+using std::string;
+using std::vector;
+using std::sort;
+using std::random_shuffle;
#include "simple.hxx"
#include "dynamics.hxx"
if (!(i->getCodes().empty()))
{
if ((i->getCodes().find(airline,0) == string::npos))
- {
- available = false;
- continue;
- }
+ {
+ available = false;
+ continue;
+ }
}
if (i->getType() != flType)
{
i->setAvailable(false);
found = true;
}
- }
+ }
// And finally once more if that didn't work. Now ignore the airline codes, as a last resort
for (i = parkings.begin(); !(i == parkings.end() || found); i++)
{
}
}
-FGParking *FGAirportDynamics::getParking(int i)
+FGParking *FGAirportDynamics::getParking(int id)
{
- if (i < (int)parkings.size() && (i >= 0))
- return &(parkings[i]);
- else
+ FGParkingVecIterator i = parkings.begin();
+ for (i = parkings.begin(); i != parkings.end(); i++)
+ {
+ if (id == i->getIndex()) {
+ return &(*i);
+ }
+ }
return 0;
}
-string FGAirportDynamics::getParkingName(int i)
+string FGAirportDynamics::getParkingName(int id)
{
- if (i < (int)parkings.size() && i >= 0)
- return (parkings[i].getName());
- else
+ FGParkingVecIterator i = parkings.begin();
+ for (i = parkings.begin(); i != parkings.end(); i++)
+ {
+ if (id == i->getIndex()) {
+ return i->getName();
+ }
+ }
+
return string("overflow");
}
void FGAirportDynamics::releaseParking(int id)
currentlyActive = &ulActive;
}
//
- currRunwayGroup->setActive(_ap->getId(),
+ currRunwayGroup->setActive(_ap,
windSpeed,
windHeading,
maxTail,
string FGAirportDynamics::chooseRunwayFallback()
{
- FGEnvironment
- stationweather = ((FGEnvironmentMgr *) globals->get_subsystem("environment"))
- ->getEnvironment(getLatitude(),
- getLongitude(),
- getElevation());
-
- double windSpeed = stationweather.get_wind_speed_kt();
- double windHeading = stationweather.get_wind_from_heading_deg();
- if (windSpeed == 0) {
- windHeading = 270; // This forces West-facing rwys to be used in no-wind situations
- //which is consistent with Flightgear's initial setup.
- }
-
- return globals->get_runways()->search(_ap->getId(), int(windHeading));
+ FGRunway* rwy = _ap->getActiveRunwayForUsage();
+ return rwy->ident();
}
void FGAirportDynamics::addParking(FGParking& park) {