General Question CTD on reload

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
I am puzzled. I am working on a vessel I have removed most everything. But when I load in a scenario no problem. But when I reload the current a CTD. Nothing in the log.
cpp

Code:
// ==============================================================
//                 ORBITER MODULE: TAELON5
//                  Part of the ORBITER SDK
//          Copyright (C) 2002-2004 Martin Schweiger
//                   All rights reserved
//
// TAELON5.cpp
// Control module for TAELON5 vessel class
//

// ==============================================================
#define ORBITER_MODULE
#include "orbitersdk.h"
#include "TAELON5.h"

#include "OrbiterSoundSDK35.h"
VISHANDLE MainExternalMeshVisual = 0;




// Constructor
TAELON5::TAELON5 (OBJHANDLE hObj, int fmodel)
: VESSEL2 (hObj, fmodel)



{

    DefineAnimations();
}



//
void TAELON5::clbkSetClassCaps (FILEHANDLE cfg)
//void TAELON5::SetTransporter()
{
    SetSize(3);
    SetEmptyMass(8000);
    SetCW(0.9, 0.9, 2, 1.4);
    SetWingAspect(0.7);
    SetWingEffectiveness(2.5);
    SetCrossSections(_V(5.56, 7.71, 4.81));
    SetRotDrag(_V(1.5, 1.5, 1.5));
    if (GetFlightModel() >= 1) {
        SetPitchMomentScale(0);
        SetBankMomentScale(0);
    }
    SetPMI(_V(3.41, 4.30, 1.56));
    SetTrimScale(.05);
    SetCameraOffset(_V(0, 0.870, 1.790));


    SetTouchdownPoints(_V(0, -1.2345, 10), _V(-5, -1.2345, -10), _V(5, -1.2345, -10));;
    EnableTransponder(true);






    // visual specs
    MAINMESH = AddMesh(oapiLoadMeshGlobal("drone166"));
    SetMeshVisibilityMode(MAINMESH, MESHVIS_EXTERNAL);

    //COCKPITMESH = AddMesh(oapiLoadMeshGlobal("TAELONCOCKPIT"));
    //SetMeshVisibilityMode(COCKPITMESH, MESHVIS_COCKPIT);
    




}








void TAELON5::clbkPostStep(double simt, double simdt, double mjd)
{

}
















void TAELON5::DefineAnimations(void)

{

}
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new TAELON5 (hvessel, flightmodel);
}

DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (TAELON5*)vessel;
}



// --------------------------------------------------------------
// Keyboard interface handler (buffered key events)
// --------------------------------------------------------------
int TAELON5::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate)
{
    // only process keydown events
    if (!down) 
        return 0; 


    return 0;
}

// ====================================================================
// clbkVisualCreated used to display UMMU initialisation message 
// because oapiDebugString() doesn't work in clbkSetClassCap
// ====================================================================
void TAELON5::clbkVisualCreated (VISHANDLE vis, int refcount)
{   
    MainExternalMeshVisual = GetMesh(vis,0);
    
}
// ==============================================================
// Visual destroyed
// ==============================================================
void TAELON5::clbkVisualDestroyed (VISHANDLE vis, int refcount)
{
    MainExternalMeshVisual = 0;    
}



// ========================================================================
// clbkLoadState function of Orbiter - Save scenario when user exit Orbiter 
// ========================================================================

//------------------------------------------------------------------------------------------------------------------
// This below is not mandatory for UMmu to run.
//------------------------------------------------------------------------------------------------------------------

// ==========================================================
// USING TEXT INTERFACE FOR CREW MANAGMENT (not a good idea)
//
// This is the custom functions that send oapiDebugString() Message on screen
// it simply avoid that the message is sent if our ship don't have the focus
// and ensure that message will be reminded when we focus back on ship
// the Orbiter function below clbkFocusChanged is used to erase message when
// we lost focus.
// It's a bad idea to do an UMmu user interface only by using Debug screen message 
// but if you can't do better you may use this system.
///////////////////////////////////////////////////////////////////////////////////////////

// --------------------------------------------------------------
// Orbiter's HUD callback
// used to display UMMU's message see PDF doc:
// "Example of feedback method by HUD Display"
// --------------------------------------------------------------
void TAELON5::clbkSaveState(FILEHANDLE scn)
{
    char cbuf[256];




    // ORBITER, default vessel parameters
    SaveDefaultState(scn);




}
void TAELON5::clbkLoadStateEx(FILEHANDLE scn, void *status)
{
    char *line;
    while (oapiReadScenario_nextline(scn, line))
    {




        ParseScenarioLineEx(line, status);
    }


}

h.
Code:
// ==============================================================
//                 ORBITER MODULE: EAGLEHANGAR2
//                  Part of the ORBITER SDK
//          Copyright (C) 2002-2004 Martin Schweiger
//                   All rights reserved
//
// EAGLEHANGAR2.cpp
// Control module for EAGLEHANGAR2 vessel class
//
// Notes:
// This is an example for a "minimal" vessel implementation which
// only overloads the clbkSetClassCaps method to define vessel
// capabilities and otherwise uses the default VESSEL class
// behaviour.
// ==============================================================
const double PB_FUELMASS = 10000;
const double PB_ISP = 2.5e7;
const double ISP = 2e5;
const double MAIN_ISP = 2e5;


const double MAX_FUEL = 10000;
const double MAX_MAIN_THRUST = 200000;
//const double MAX_MAIN_THRUST = 10;
const double MAX_RCS_THRUST = 5000;
//const double SYSTEMS_THRUST = 0;
const double MAX_HOVER_THRUST = 400000;
//#include "orbitersdk.h"

// ==============================================================
// Some vessel parameters
// ==============================================================

// Interface for derived vessel class: QJBStar
// ==========================================================

class TAELON5: public VESSEL2 {
public:
    TAELON5 (OBJHANDLE hObj, int fmodel);
    void clbkSetClassCaps (FILEHANDLE cfg);
    void clbkSaveState(FILEHANDLE scn);
    void clbkLoadStateEx(FILEHANDLE scn, void *status);
    int clbkConsumeBufferedKey(DWORD key, bool down, char *kstate);
    void clbkVisualCreated (VISHANDLE vis, int refcount);
     void DefineAnimations(void); 
    void clbkVisualDestroyed (VISHANDLE vis, int refcount);
    void clbkPostStep (double simtt, double simdt, double mjd);


    UINT  MAINMESH ;


};

I have tried different meshes but no change

scenario
TAELON5:TAELON5
STATUS Orbiting Earth
RPOS 7007601.49 -0.00 84505.99
RVEL -90.940 -0.000 7541.137
AROT 0.00 -0.00 0.00
AFCMODE 7
NAVFREQ 0 0
XPDR 0
END
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
What about posting the current scenario's content? And the full original scenario as well...
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Thanks. Weird it works now. I am slowing adding things and see when I get a CTD

scenario
BEGIN_DESC

END_DESC

BEGIN_ENVIRONMENT
System Sol
Date MJD 51981.6019964950
END_ENVIRONMENT

BEGIN_FOCUS
Ship TAELON5
END_FOCUS

BEGIN_CAMERA
TARGET TAELON5
MODE Extern
POS 4.00 158.26 -66.45
TRACKMODE TargetRelative
FOV 60.00
END_CAMERA

BEGIN_MFD Left
TYPE Surface
SPDMODE 1
END_MFD

BEGIN_MFD Right
TYPE Launch
NAV 0
END_MFD

BEGIN_SHIPS
TAELON5:TAELON5
STATUS Landed Earth
POS -80.6758960 28.5227640
HEADING 66.56
AFCMODE 7
PRPLEVEL 0:1.000000
NAVFREQ 0 0
XPDR 0
END
END_SHIPS

BEGIN_Attachment Manager
END
current:
BEGIN_DESC
Contains the latest simulation state.
END_DESC

BEGIN_ENVIRONMENT
System Sol
Date MJD 51981.6023816632
END_ENVIRONMENT

BEGIN_FOCUS
Ship TAELON5
END_FOCUS

BEGIN_CAMERA
TARGET TAELON5
MODE Extern
POS 4.00 -164.32 -66.45
TRACKMODE TargetRelative
FOV 60.00
END_CAMERA

BEGIN_MFD Left
TYPE Surface
SPDMODE 1
END_MFD

BEGIN_MFD Right
TYPE Launch
NAV 0
END_MFD

BEGIN_SHIPS
TAELON5:TAELON5
STATUS Landed Earth
POS -80.6758960 28.5227640
HEADING 66.56
AFCMODE 7
NAVFREQ 0 0
XPDR 0
END
END_SHIPS


I added these and get a ctd on reload

Code:
void TAELON5::clbkPostStep(double simt, double simdt, double mjd)
{

	
	THRUSTLEVELMAIN = (GetThrusterLevel(th_main[0]));
	THRUSTLEVELRETRO = (GetThrusterLevel(th_retro[0]));
	THRUSTLEVELHOVER = (GetThrusterLevel(th_hover[0]));














}

h:
Code:
	THRUSTER_HANDLE th_main[2];                  // main engine handles
	THRUSTER_HANDLE th_retro[2];                 // retro engine handles
	THRUSTER_HANDLE th_hover[2];                 // hover engine handles
	THRUSTER_HANDLE th_rcs[20], th_group[4];

	THGROUP_HANDLE thg_main;
	THGROUP_HANDLE thg_retro;
	THGROUP_HANDLE thg_hover;

double THRUSTLEVELMAIN, THRUSTLEVELRETRO, THRUSTLEVELHOVER;
 
Last edited:

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,842
Reaction score
2,105
Points
203
Location
between the planets
But when I load in a scenario no problem. But when I reload the current a CTD.

Does this apply only if you reload the current state without closing the launchpad first? In that case, the most likely problem is improper deallocation of memory when the simulation ends.

I added these and get a ctd on reload

I might be missing something, but I can't find where you're initialising the thruster groups you're trying to query in that code.

Also, is there a particular reason you inherit VESSEL2? If there isn't, I would move up to VESSEL3.
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Thanks. Yes I made it vessel2 so another add-on would work. I get no ctd now. I haven't load Ummu sopport as yet.
Yes I made the thrusters
 
Top