The standard constructor for a simple vessel is given as such in the sample code:
However, while this has worked for me consistently in the past, it no longer builds, instead giving this error:
I've only recently gotten back to Orbiter developing, and in that time my installation of VC++ Express has updated. Does anyone know of a configuration or build setting that could be to blame for this?
In the very likely case that the error is all mine, here is the full code:
Aeroshield.h:
Aeroshield.cpp:
Code:
Vesselname::Vesselname (OBJHANDLE hVessel, int flightmodel)
: VESSEL3 (hVessel, flightmodel)
{
}
However, while this has worked for me consistently in the past, it no longer builds, instead giving this error:
Code:
1>Aeroshield.cpp(16): error C2533: 'Aeroshield::{ctor}' : constructors not allowed a return type
I've only recently gotten back to Orbiter developing, and in that time my installation of VC++ Express has updated. Does anyone know of a configuration or build setting that could be to blame for this?
In the very likely case that the error is all mine, here is the full code:
Aeroshield.h:
Code:
/*
Scott Zirpolo
22 October, 2012
This code is free to copy and use.
*/
#include "OrbiterAPI.h"
#include "Orbitersdk.h"
#include "VesselAPI.h"
#define ORBITER_MODULE
class Aeroshield: public VESSEL3
{
public:
Aeroshield(OBJHANDLE hVessel, int flightmodel);
~Aeroshield();
void clbkSetClassCaps(FILEHANDLE cfg);
void clbkLoadStateEx(FILEHANDLE scn, void *status);
void clbkSaveState(FILEHANDLE scn);
//VARIABLES
double size;
double mass;
VECTOR3 pmi;
VECTOR3 cs;
VECTOR3 dockLocation;
double cw[4];
double rotResistance;
double wingAspect;
DOCKHANDLE hardpoint;
DWORD meshType;
}
Aeroshield.cpp:
Code:
/*
Scott Zirpolo
22 October, 2012
This code is free to copy and use.
*/
#include "OrbiterAPI.h"
#include "Orbitersdk.h"
#include "VesselAPI.h"
#include "Aeroshield.h"
#define ORBITER_MODULE
Aeroshield::Aeroshield (OBJHANDLE hVessel, int flightmodel)
: VESSEL3 (hVessel, flightmodel)
{
}
Aeroshield::~Aeroshield()
{
}
void Aeroshield::clbkLoadStateEx(FILEHANDLE scn, void *status)
{
char *line;
while (oapiReadScenario_nextline(scn,line))
{
if (!strnicmp(line, "TYPE", 4)) //0-2. 0:Small, 1:Medium, 2:Large
sscanf(line+4, "%u", &meshType);
else
ParseScenarioLineEx(line, status);
}
switch (meshType)
{
case 0:
size = 51;
mass = 1000;
pmi = _V(10090.84, 10090.84, 278.57);
cs = _V(83.45, 83.45, 2255.12);
cw[0] = 200;
cw[1] = 200;
cw[2] = 8;
cw[3] = 8;
rotResistance = 80;
dockLocation = _V(0, 0, 99.6);
case 1:
size = 107;
mass = 3500;
pmi = _V(558.13, 558.13, 1114.28); //PMI and CS need correction. I'm not sure where the numbers came from.
cs = _V(333.80, 333.80, 9020.50);
cw[0] = 500;
cw[1] = 500;
cw[2] = 10;
cw[3] = 10;
rotResistance = 200;
dockLocation = _V(0, 0, 99.8);
case 2:
size = 161;
mass = 6500;
pmi = _V(41273.24, 41273.24, 2507.14);
cs = _V(750.90, 750.90, 20296.10);
cw[0] = 600;
cw[1] = 600;
cw[2] = 11;
cw[3] = 11;
rotResistance = 300;
dockLocation = _V(0, 0, 199.8);
}
}
void Aeroshield::clbkSetClassCaps(FILEHANDLE cfg)
{
SetSize(size);
SetEmptyMass(mass);
SetPMI(pmi);
SetCrossSections(cs);
SetCW(cw[0],cw[1],cw[2],cw[3]);
SetRotDrag(_V(rotResistance,rotResistance,rotResistance));
EnableTransponder(true);
SetTransponderChannel(198);
hardpoint = CreateDock(dockLocation, _V(0,0,-1),_V(0,1,0));
}
void Aeroshield::clbkSaveState(FILEHANDLE scn)
{
VESSEL3::SaveDefaultState(scn);
oapiWriteScenario_int(scn,"TYPE",meshType);
}
DLLCLBK VESSEL *ovcInit (OBJHANDLE hVessel, int flightmodel)
{
return new Aeroshield(hVessel, flightmodel);
}
DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (Aeroshield*)vessel;
}