1
0
Fork 0
flightgear/src/AIModel/performancedb.hxx
James Turner 7d547d1287 Make traffic take-off roll look a little better.
Expand the performance DB logic to support aliases, and select based on aircraft type as well as class. This allows to introduce some variation into AI traffic performance. Change the initial climb-out waypoints to use pitch-hold until passing 3000', which looks much more convincing
2012-10-05 18:12:46 +01:00

48 lines
1.3 KiB
C++
Raw Blame History

#ifndef PERFORMANCEDB_HXX
#define PERFORMANCEDB_HXX
#include <string>
#include <map>
#include <vector>
class PerformanceData;
class SGPath;
/**
* Registry for performance data.
*
* Allows to store performance data for later reuse/retrieval. Just
* a simple map for now.
*
* @author Thomas F<>rster <t.foerster@biologie.hu-berlin.de>
*/
//TODO provide std::map interface?
class PerformanceDB
{
public:
PerformanceDB();
~PerformanceDB();
void registerPerformanceData(const std::string& id, PerformanceData* data);
void registerPerformanceData(const std::string& id, const std::string& filename);
/**
* get performance data for an aircraft type / class. Type is specific, eg
* '738' or 'A319'. Class is more generic, such as 'jet_transport'.
*/
PerformanceData* getDataFor(const std::string& acType, const std::string& acClass);
void load(const SGPath& path);
private:
std::map<std::string, PerformanceData*> _db;
std::string findAlias(const std::string& acType) const;
typedef std::pair<std::string, std::string> StringPair;
/// alias list, to allow type/class names to share data. This is used to merge
/// related types together. Note it's ordered, and not a map since we permit
/// partial matches when merging - the first matching alias is used.
std::vector<StringPair> _aliases;
};
#endif