Like the title says, I need help breaking a monster-sized (vessel) class into more managable sub-classes.
Specifically I want to take my Lunar Lander's autopilot functions/variables and (for the sake of readability) place them in their own class.
However the base vessel class still needs acces to some of those variables for situations like.
I tried copying the syntax of the DG's AAP but that hasn't worked
As per the DG example LEM_AP is defined as a friend class to SpiderLEM (my vessel class)
The LEM_AP class itself looks like this
Finally we have the .cpp file which looks like this...
As it stands I'm getting a compiler error wich states that the LEM_AP constructor is invalid.
If I comment the constructor out the code compiles but I am unable to call any of LEM_AP's functions.
Please help a C++ noob figure this out.
Specifically I want to take my Lunar Lander's autopilot functions/variables and (for the sake of readability) place them in their own class.
However the base vessel class still needs acces to some of those variables for situations like.
Code:
if (ThrotControlAuto()) SetThrusterGroupLevel(THGROUP_HOVER, AP_CommandedThrust);
I tried copying the syntax of the DG's AAP but that hasn't worked
As per the DG example LEM_AP is defined as a friend class to SpiderLEM (my vessel class)
Code:
class SpiderLEM: public VESSEL3 {
friend class LEM_AP; // LEM Autopilot Class
public:
SpiderLEM (OBJHANDLE hVessel, int flightmodel);
~SpiderLEM ();
...
The LEM_AP class itself looks like this
Code:
// ==============================================================
// ORBITER MODULE: 'SPIDER' LUNAR EXCURSION MODULE
// A custom Vessel For Orbiter 2010/2011
//
// LEM_Autopilots.h
// Class interface for Lunar Excursion Module Autopilot
// ==============================================================
#include "Orbitersdk.h"
#include "SpiderLEM.h"
class VESSEL3;
class LEM_AP: public SpiderLEM {
public:
LEM_AP (VESSEL3 *v);
virtual ~LEM_AP ();
// Autopilot Functions
void OrientForBurn(VECTOR3& tgtVector);
void SetPitch(double tgtPitch);
void SetRoll(double tgtRoll);
void SetHdg(double tgtHdg);
void AutoHover(void);
void AutoAscent(double simt);
void AutoLand(double simt);
double rRate;
double AP_CommandedThrust, AP_CommandedYaw, AP_CommandedRoll, AP_CommandedPitch; // Autopilot control inputs
protected:
VESSEL3 *vessel;
private:
int AP_ProgState; // current autopilot program state
};
Finally we have the .cpp file which looks like this...
Code:
#include "LEM_Autopilots.h"
LEM_AP::LEM_AP (SpiderLEM *vessel)
{
}
LEM_AP::~LEM_AP ()
{
}
Assorted Functions beyond this point...
As it stands I'm getting a compiler error wich states that the LEM_AP constructor is invalid.
If I comment the constructor out the code compiles but I am unable to call any of LEM_AP's functions.
Please help a C++ noob figure this out.