XPMP2
X-Plane multiplayer library 2 - using instancing
RelatedDoc8643.cpp File Reference

Reading of supporting text files: More...

#include "XPMP2.h"

Namespaces

namespace  XPMP2
 

Macros

#define DEBUG_READ_RELATED   "Reading from '%s'"
 
#define ERR_RELATED_NOT_FOUND   "Could not open the file for reading"
 
#define WARN_DUP_RELATED_ENTRY   "%s: Duplicate entry for '%s' in line %d"
 
#define DEBUG_READ_DOC8643   "doc8643.txt: Reading from '%s'"
 
#define ERR_DOC8643_NOT_FOUND   "doc8643.txt: Could not open the file for reading"
 
#define ERR_DOC8643_READ_ERR   "doc8643.txt: Line %d did not match expectations: %s"
 
#define DEBUG_READ_OBJ8DR   "Obj8DataRefs.txt: Trying to read from '%s'"
 
#define ERR_OBJ8DR_NOT_FOUND   "Obj8DataRefs.txt: Could not open the file for reading"
 
#define ERR_CFG_LINE_READ   "Error '%s' while reading line %d of %s"
 
#define ERR_CFG_FILE_TOOMANY   "Too many errors while trying to read file"
 

Functions

const char * XPMP2::RelatedLoad (RelTxtTy relType, const std::string &_path)
 Read the related.txt file, full path passed in.
 
const char * XPMP2::RelatedLoad (const std::string _paths[], size_t _num)
 Load all related files.
 
int XPMP2::RelatedGet (RelTxtTy relType, const std::string &_key)
 Find the related group for a given key, 0 if none.
 
const char * XPMP2::Doc8643Load (const std::string &_path)
 Load the content of the provided Doc8643.txt file.
 
const Doc8643XPMP2::Doc8643Get (const std::string &_type)
 Return a reference to the matching Doc8643 object.
 
bool XPMP2::Doc8643IsTypeValid (const std::string &_type)
 Is the given aircraft type a valid ICAO type as per Doc8643?
 
const char * XPMP2::Obj8DataRefsLoad (const std::string &_path)
 Load the content of the provided Obj8DataRefs.txt file.
 

Variables

constexpr int XPMP2::ERR_CFG_FILE_MAXWARN = 5
 Maximum number of warnings during file read before bailing.
 
const Doc8643 XPMP2::DOC8643_EMPTY
 

Detailed Description

Reading of supporting text files:

  • related.txt for creating groups of similar looking aircraft types;
  • relOp.txt for creating groups of similar looking operator (liveries)
  • Doc8643.txt, the official list of ICAO aircraft type codes;
  • Obj8DataRefs.txt, a mapping list for replacing dataRefs in .obj files.

A related group is declared simply by a line of ICAO a/c type codes read from the file. Internally, the group is just identified by its line number in related.txt. So the group "44" might be "A306 A30B A310", the Airbus A300 series. Similarly, a group of operators is typically a group of mother/subsidiary companies using the same or very similar liveries.

Doc8643 is a list of information maintained by the ICAO to list all registered aircraft types. Each type designator can appear multiple times in the dataset for slightly differing models, but the classification und the WTC will be the same in all those listing.
XPMP2 is only interested in type designator, classification, and WTC.

Author
Birger Hoppe

Macro Definition Documentation

◆ DEBUG_READ_DOC8643

#define DEBUG_READ_DOC8643   "doc8643.txt: Reading from '%s'"

◆ DEBUG_READ_OBJ8DR

#define DEBUG_READ_OBJ8DR   "Obj8DataRefs.txt: Trying to read from '%s'"

◆ DEBUG_READ_RELATED

#define DEBUG_READ_RELATED   "Reading from '%s'"

◆ ERR_CFG_FILE_TOOMANY

#define ERR_CFG_FILE_TOOMANY   "Too many errors while trying to read file"

◆ ERR_CFG_LINE_READ

#define ERR_CFG_LINE_READ   "Error '%s' while reading line %d of %s"

◆ ERR_DOC8643_NOT_FOUND

#define ERR_DOC8643_NOT_FOUND   "doc8643.txt: Could not open the file for reading"

◆ ERR_DOC8643_READ_ERR

#define ERR_DOC8643_READ_ERR   "doc8643.txt: Line %d did not match expectations: %s"

◆ ERR_OBJ8DR_NOT_FOUND

#define ERR_OBJ8DR_NOT_FOUND   "Obj8DataRefs.txt: Could not open the file for reading"

◆ ERR_RELATED_NOT_FOUND

#define ERR_RELATED_NOT_FOUND   "Could not open the file for reading"

◆ WARN_DUP_RELATED_ENTRY

#define WARN_DUP_RELATED_ENTRY   "%s: Duplicate entry for '%s' in line %d"