1 #include "performancedb.hxx"
3 PerformanceDB::PerformanceDB()
5 // these are the 6 classes originally defined in the PERFSTRUCT
6 registerPerformanceData("light", new PerformanceData(
7 2.0, 2.0, 450.0, 1000.0, 70.0, 70.0, 80.0, 100.0, 80.0, 70.0, 60.0, 15.0));
8 registerPerformanceData("ww2_fighter", new PerformanceData(
9 4.0, 2.0, 3000.0, 1500.0, 110.0, 110.0, 180.0, 250.0, 200.0, 130.0, 100.0, 15.0));
10 registerPerformanceData("jet_fighter", new PerformanceData(
11 7.0, 3.0, 4000.0, 2000.0, 120.0, 150.0, 350.0, 500.0, 350.0, 170.0, 150.0, 15.0));
12 registerPerformanceData("jet_transport", new PerformanceData(
13 5.0, 2.0, 3000.0, 1500.0, 100.0, 140.0, 300.0, 430.0, 300.0, 170.0, 130.0, 15.0));
14 registerPerformanceData("tanker", new PerformanceData(
15 5.0, 2.0, 3000.0, 1500.0, 100.0, 140.0, 300.0, 430.0, 300.0, 170.0, 130.0, 15.0));
16 registerPerformanceData("ufo", new PerformanceData(
17 30.0, 30.0, 6000.0, 6000.0, 150.0, 150.0, 300.0, 430.0, 300.0, 170.0, 130.0, 15.0));
22 PerformanceDB::~PerformanceDB()
25 void PerformanceDB::registerPerformanceData(const std::string& id, PerformanceData* data) {
26 //TODO if key exists already replace data "inplace", i.e. copy to existing PerfData instance
27 // this updates all aircraft currently using the PerfData instance.
31 void PerformanceDB::registerPerformanceData(const std::string& id, const std::string& filename) {
32 registerPerformanceData(id, new PerformanceData(filename));
35 PerformanceData* PerformanceDB::getDataFor(const std::string& id) {
36 if (_db.find(id) == _db.end()) // id not found -> return jet_transport data
37 return _db["jet_transport"];