Jump to content

cstrosser

Members
  • Posts

    5
  • Joined

  • Last visited

cstrosser's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. And the header file... #ifndef AIRCRAFTB744_H #define AIRCRAFTB744_H #include "aircraft.h" #include "XPLMDataAccess.h" class Aircraft_B744_Radio { public: void setFine(int fineValue); int getFine(); void setCoarse(int coarseValue); int getCoarse(); virtual void fineUp(int fast = 0) = 0; virtual void fineDown(int fast = 0) = 0; virtual void coarseUp() = 0; virtual void coarseDown() = 0; virtual XPLMDataRef getFineDataref() = 0; virtual XPLMDataRef getCoarseDataref() = 0; }; class Aircraft_B744_Radio_Com : public Aircraft_B744_Radio { public: void fineUp(int fast = 0); void fineDown(int fast = 0); void coarseUp(); void coarseDown(); }; class Aircraft_B744_Radio_Nav : public Aircraft_B744_Radio { public: void fineUp(int fast = 0); void fineDown(int fast = 0); void coarseUp(); void coarseDown(); }; class Aircraft_B744_Radio_Com1 : public Aircraft_B744_Radio_Com { public: XPLMDataRef getFineDataref(); XPLMDataRef getCoarseDataref(); }; class Aircraft_B744_Radio_Nav1 : public Aircraft_B744_Radio_Nav { public: XPLMDataRef getFineDataref(); XPLMDataRef getCoarseDataref(); }; class Aircraft_B744_Radio_Nav2 : public Aircraft_B744_Radio_Nav { public: XPLMDataRef getFineDataref(); XPLMDataRef getCoarseDataref(); }; class Aircraft_B744 : public Aircraft { private: Aircraft_B744(){}; Aircraft_B744(Aircraft_B744 const&){}; Aircraft_B744 operator=(Aircraft_B744 const&){}; static Aircraft_B744* instance; protected: Aircraft_B744_Radio_Com1* com1; Aircraft_B744_Radio_Nav1* nav1; Aircraft_B744_Radio_Nav2* nav2; public: static Aircraft_B744* getInstance(); const char* getICAO(); Aircraft_B744_Radio_Com1* getCom1(); Aircraft_B744_Radio_Nav1* getNav1(); Aircraft_B744_Radio_Nav2* getNav2(); }; #endif // AIRCRAFTB744_H
  2. This is the code I used for the B744. If I remember correctly, I had to scrap it because I kept getting crashes whenever I tried to switch from active/standby. #include "loader.h" #include "aircraft-b744.h" Aircraft_B744* Aircraft_B744::instance = NULL; Aircraft_B744* Aircraft_B744::getInstance() { if (!instance) { instance = new Aircraft_B744(); } return instance; } const char* Aircraft_B744::getICAO() { return "B744"; } Aircraft_B744_Radio_Com1* Aircraft_B744::getCom1() { if (!com1) { com1 = new Aircraft_B744_Radio_Com1(); } return com1; } Aircraft_B744_Radio_Nav1* Aircraft_B744::getNav1() { if (!nav1) { nav1 = new Aircraft_B744_Radio_Nav1(); } return nav1; } Aircraft_B744_Radio_Nav2* Aircraft_B744::getNav2() { if (!nav2) { nav2 = new Aircraft_B744_Radio_Nav2(); } return nav2; } void Aircraft_B744_Radio::setFine(int fineValue) { XPLMSetDatai(getFineDataref(), fineValue); } int Aircraft_B744_Radio::getFine() { return XPLMGetDatai(getFineDataref()); } void Aircraft_B744_Radio::setCoarse(int coarseValue) { XPLMSetDatai(getCoarseDataref(), coarseValue); } int Aircraft_B744_Radio::getCoarse() { return XPLMGetDatai(getCoarseDataref()); } void Aircraft_B744_Radio_Com::fineUp(int fast) { int ComDec1Value = getFine(); if (fast) { ComDec1Value += 3; } else { ComDec1Value += 1; } if (ComDec1Value > 99) { ComDec1Value -= 100; } setFine(ComDec1Value); } void Aircraft_B744_Radio_Com::fineDown(int fast) { int ComDec1Value = getFine(); if (fast) { ComDec1Value -= 3; } else { ComDec1Value -= 1; } if (ComDec1Value < 0) { ComDec1Value += 100; } setFine(ComDec1Value); } void Aircraft_B744_Radio_Com::coarseUp() { int ComNum1Value = getCoarse() + 1; if (ComNum1Value > 136) { ComNum1Value = 118; } setCoarse(ComNum1Value); } void Aircraft_B744_Radio_Com::coarseDown() { int ComNum1Value = getCoarse() - 1; if (ComNum1Value < 118) { ComNum1Value = 136; } setCoarse(ComNum1Value); } void Aircraft_B744_Radio_Nav::fineUp(int fast) { int Nav1DecValue = getFine(); if (fast) { Nav1DecValue += 3; } else { Nav1DecValue += 1; } if (Nav1DecValue > 99) { Nav1DecValue -= 100; } setFine(Nav1DecValue); } void Aircraft_B744_Radio_Nav::fineDown(int fast) { int Nav1DecValue = getFine(); if (fast) { Nav1DecValue -= 3; } else { Nav1DecValue -= 1; } if (Nav1DecValue < 0) { Nav1DecValue += 100; } setFine(Nav1DecValue); } void Aircraft_B744_Radio_Nav::coarseUp() { int Nav1NumValue = getCoarse() + 1; if (Nav1NumValue > 117) { Nav1NumValue = 108; } setCoarse(Nav1NumValue); } void Aircraft_B744_Radio_Nav::coarseDown() { int Nav1NumValue = getCoarse() - 1; if (Nav1NumValue < 108) { Nav1NumValue = 117; } setCoarse(Nav1NumValue); } XPLMDataRef Aircraft_B744_Radio_Com1::getFineDataref() { return XGF::LazyLoader::getDataref("747/ComDec1"); } XPLMDataRef Aircraft_B744_Radio_Com1::getCoarseDataref() { return XGF::LazyLoader::getDataref("747/Nav1Num"); } XPLMDataRef Aircraft_B744_Radio_Nav1::getFineDataref() { return XGF::LazyLoader::getDataref("747/Nav1Dec"); } XPLMDataRef Aircraft_B744_Radio_Nav1::getCoarseDataref() { return XGF::LazyLoader::getDataref("747/Nav1Num"); } XPLMDataRef Aircraft_B744_Radio_Nav2::getFineDataref() { return XGF::LazyLoader::getDataref("747/Nav2Dec"); } XPLMDataRef Aircraft_B744_Radio_Nav2::getCoarseDataref() { return XGF::LazyLoader::getDataref("747/Nav2Num"); }
  3. What I was saying was that it is not as easy as simply dealing with datarefs (not always, anyway). Take the 747... I created code that MOSTLY allowed Bill's plugin to work with the customized tuners, but something internal to the plugin stopped me dead in my tracks by causing a crash. Sure, we can change the datarefs with other plugins, but we can't control how the aircraft plugins react to that change. Again, if this aircraft allowed use of the native commands for tuning (CRJ2, Peter's Airbuses, ddenn's CL30, x737, etc. etc. etc.), that would solve compatibility for ALL hardware. There is no practical reason to stray from the norm for this particular feature, at least not that I've ever seen.
  4. I was about to purchase this aircraft until I saw this thread. With most custom aircraft functionality, it is relatively simple to map hardware to custom datarefs. In fact, I created my XGoFlight plugin to deal with the fact that Sandy's plugin only addresses default functionality. As a person who buys most high-quality aircraft, I can say I'm fully committed to finding ways to ensure hardware works with ALL and ANY aircraft (e.g. CRJ2, Challenger 300, Peter's Airbus A380, FlyJSim 727/DH8D, etc.). This is probably my only red line. With the radios, everything gets trickier. The native 747 implements custom datarefs for radio frequencies, and for those of us with hardware, it only messes up the experience without adding any value. From what I've gathered, the 747 uses this methodology so that users can tune frequencies to the hundredth decimal place rather than relying on the hundredth decimal place intervals that X-Plane uses. If the CRJ2 and other aircraft at that level of complexity can find a way to make the radio frequencies work with standard datarefs, I don't see why we can't do the same in all cases. Honestly, I wish we could all agree to work within the constraints of the X-Plane COM/NAV frequencies. It just makes things unnecessarily complicated without adding much value. I'll follow this issue for a little longer b/c the aircraft looks stunning. I'd love the opportunity to add it to my vast collection in the future.
  5. I have two GoFlight modules, and have pretty much maxed out the default functionality I would use. It is the only thing that has prevented me from buying more GF modules. If the source was available, I would add the custom functionality myself!
×
×
  • Create New...