1
0
Fork 0
flightgear/src/AIModel/performancedb.cxx
durk c6f88e5b9b Development for two new features:
* Some support for geometry information provided by the custom scenery
   project. Current support is for AI groundnets and runway use files only
   since this is a switch that involves a lot of data verification and
   updating, during the transistion the actual path where the data can be
   read from is user configurable. setting the property

   /sim/traffic-manager/use-custom-scenery-data to true

  will cause flightgear to read the ground networks from the scenery
  directory (--{fg-scenery}/Airports/[I]/[C]/[A]/[ICAO].groundnet.xml to be
  precise). Setting this property to false will retain the original
  behvior.
* For departing aircraft, runway takeoff calculations will be done on the
  basis of the performance database. For testing purposes, a performance
 estimate for a heavy jet has been added.
2009-02-01 23:44:10 +01:00

43 lines
1.9 KiB
C++

#include "performancedb.hxx"
PerformanceDB::PerformanceDB()
{
// these are the 6 classes originally defined in the PERFSTRUCT
// Plus a few more for testing
registerPerformanceData("heavy_jet", new PerformanceData(
4.0, 2.0, 3000.0, 1500.0, 150.0, 160.0, 300.0, 430.0, 300.0, 170.0, 150.0, 15.0));
registerPerformanceData("light", new PerformanceData(
2.0, 2.0, 450.0, 1000.0, 70.0, 70.0, 80.0, 100.0, 80.0, 70.0, 60.0, 15.0));
registerPerformanceData("ww2_fighter", new PerformanceData(
4.0, 2.0, 3000.0, 1500.0, 110.0, 110.0, 180.0, 250.0, 200.0, 130.0, 100.0, 15.0));
registerPerformanceData("jet_fighter", new PerformanceData(
7.0, 3.0, 4000.0, 2000.0, 120.0, 150.0, 350.0, 500.0, 350.0, 170.0, 150.0, 15.0));
registerPerformanceData("jet_transport", new PerformanceData(
5.0, 2.0, 3000.0, 1500.0, 100.0, 140.0, 300.0, 430.0, 300.0, 170.0, 130.0, 15.0));
registerPerformanceData("tanker", new PerformanceData(
5.0, 2.0, 3000.0, 1500.0, 100.0, 140.0, 300.0, 430.0, 300.0, 170.0, 130.0, 15.0));
registerPerformanceData("ufo", new PerformanceData(
30.0, 30.0, 6000.0, 6000.0, 150.0, 150.0, 300.0, 430.0, 300.0, 170.0, 130.0, 15.0));
}
PerformanceDB::~PerformanceDB()
{}
void PerformanceDB::registerPerformanceData(const std::string& id, PerformanceData* data) {
//TODO if key exists already replace data "inplace", i.e. copy to existing PerfData instance
// this updates all aircraft currently using the PerfData instance.
_db[id] = data;
}
void PerformanceDB::registerPerformanceData(const std::string& id, const std::string& filename) {
registerPerformanceData(id, new PerformanceData(filename));
}
PerformanceData* PerformanceDB::getDataFor(const std::string& id) {
if (_db.find(id) == _db.end()) // id not found -> return jet_transport data
return _db["jet_transport"];
return _db[id];
}