Problem Particle stream causes CTD when level is nonzero

Zatnikitelman

Addon Developer
Addon Developer
Joined
Jan 13, 2008
Messages
2,303
Reaction score
6
Points
38
Location
Atlanta, GA, USA, North America
Add another entry to the "list of strange bugs encountered/caused by Zatman." For some reason, any time I set the level of a particle stream on my vessel to something greater than 0, I get a CTD. I've verified that the level variable is receiving the correct value for what I'm doing. Here is the code defining the particle stream, and where level is set and modified:
Code:
void prompad::clbkSetClassCaps(FILEHANDLE cfg)
{
    ...

    exhaust.srcsize = 10;
    exhaust.srcrate = 5000;
    exhaust.srcspread = 0.25;
    exhaust.growthrate = 5;
    exhaust.v0 = 500;
    exhaust.lifetime = 5;
    exhaust.atmslowdown = 2.5;
    exhaust.ltype = exhaust.DIFFUSE;
    exhaust.levelmap = exhaust.LVL_SQRT;
    exhaust.atmsmap = exhaust.ATM_PLOG;
    exhaust.amin = 0.005;
    exhaust.amax = 0.8;
    level = 0;
    AddParticleStream (&exhaust,_V(0,-10.5,0),_V(0,0,1),&level);
}
Code:
void Prompad::clbkPreStep(double simt, double simdt, double mjd)
{
    launchSequence(simt);
    if(stream)
    {
        pstreamManage();
    }
}
Code:
void Prompad::pstreamManage(void)
{
    level = (ves->GetAltitude()*-0.0025)+1;
    //level = 0.1; [COLOR=Red]//when this is set to 0 (and un-commented, no CTD[/COLOR]
}
Thanks for any help you can provide in solving this,
Matt
 
Code:
void Prompad::pstreamManage(void)
{
    level = (ves->GetAltitude()*-0.0025)+1;
    //level = 0.1; [COLOR=red]//when this is set to 0 (and un-commented, no CTD[/COLOR]
}
Problem I detect on an initial first pass:
That code will result in a negative level whenever altitude is more than 400.

Beyond that, not sure...
 
I have code elsewhere that kills the stream if it's less than or equal to 0.

But, I have some slightly new behavior to report. When I set level just once rather than at every timestep, it still CTDs; for example, setting level = 1 in my constructor.
 
Last edited:
Have you tried to find the line where it CTDs by the old and trusted method of inserting oapiWriteLog("xx"); tracers at every other line?
 
Have you tried to find the line where it CTDs by the old and trusted method of inserting oapiWriteLog("xx"); tracers at every other line?
Or, more usefully, use the visual studio debugger...
 
Yes, I have. When I first stepped through with the debugger, it CTD'd between clbkPreStep calls. However, as I have indicated, regardless of where I set level to be nonzero, I get a CTD.
 
How is level declared?
 
Code:
class Prompad
{
  ...
  private:
  ...
  double level;
}

Prompad::Prompad(int fmodel):VESSEL2(int fmodel)//maybe not exact constructor, but you get it
{
  ...
  level = 0;
}
Prompad::clbkSetClassCaps(...)
{
  ...
  AddParticleStream(&myspec,blah,blah,[COLOR="Red"]&level[/COLOR]);
}
 
Back
Top