SDK Question 2010 compatible

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Is there anything here that's not 2010 compatible and going to make it "hang"
Code:
VOBJ * BOOMMANAGER::ReadAndAssign(char * ini, VESSEL * v)
{
	char cbuf[255], str[255];
	VOBJ * vbj = new VOBJ();
	std::vector<PVISUAL*> visuals;
	int pCount = 0;
	g_FR.LoadInt(ini,"SETTINGS","pcount",pCount);

    PVISUAL *vis;
	PARTICLESTREAMSPEC *ps;
	VECTOR3 pos;
	for (int i = 0; i < pCount; i++)
	{
		ps = new PARTICLESTREAMSPEC();
		sprintf(cbuf,"P_%d_srcsize",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->srcsize);
		sprintf(cbuf,"P_%d_srcrate",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->srcrate);
		sprintf(cbuf,"P_%d_v0",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->v0);
		sprintf(cbuf,"P_%d_srcspread",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->srcspread);
		sprintf(cbuf,"P_%d_lifetime",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->lifetime);
		sprintf(cbuf,"P_%d_growthrate",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->growthrate);
		sprintf(cbuf,"P_%d_atmslowdown",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->atmslowdown);
		sprintf(cbuf,"P_%d_lmin",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->lmin);
		sprintf(cbuf,"P_%d_lmax",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->lmax);
		sprintf(cbuf,"P_%d_amin",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->amin);
		sprintf(cbuf,"P_%d_amax",i+1);
		g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->amax);
		sprintf(cbuf,"P_%d_pos",i+1);
		g_FR.LoadVector(ini,"SETTINGS",cbuf,pos);
		sprintf(str,"P_%d_LTYPE",i+1);
		g_FR.LoadString(ini,"SETTINGS",str,cbuf);
		if (!strcmp(cbuf,"EMISSIVE"))
			ps->ltype=PARTICLESTREAMSPEC::EMISSIVE;
		else if (!strcmp(cbuf,"DIFFUSE"))
			ps->ltype=PARTICLESTREAMSPEC::DIFFUSE;
		else
			ps->ltype=PARTICLESTREAMSPEC::DIFFUSE;
		sprintf(str,"P_%d_LEVELMAP",i+1);
		g_FR.LoadString(ini,"SETTINGS",str,cbuf);
		if (!strcmp(cbuf,"LVL_FLAT"))
			ps->levelmap=PARTICLESTREAMSPEC::LVL_FLAT;
		else if(!strcmp(cbuf,"LVL_LIN"))
			ps->levelmap=PARTICLESTREAMSPEC::LVL_LIN;
		else if(!strcmp(cbuf,"LVL_SQRT"))
			ps->levelmap=PARTICLESTREAMSPEC::LVL_SQRT;
		else if(!strcmp(cbuf,"LVL_PLIN"))
			ps->levelmap=PARTICLESTREAMSPEC::LVL_PLIN;
		else if (!strcmp(cbuf,"LVL_PSQRT"))
			ps->levelmap=PARTICLESTREAMSPEC::LVL_PSQRT;
		else
			ps->levelmap=PARTICLESTREAMSPEC::LVL_SQRT;
		sprintf(str,"P_%d_ATMSMAP",i+1);
		g_FR.LoadString(ini,"SETTINGS",str,cbuf);
		if (!strcmp(cbuf,"ATM_FLAT"))
			ps->atmsmap=PARTICLESTREAMSPEC::ATM_FLAT;
		else if (!strcmp(cbuf,"ATM_PLIN"))
			ps->atmsmap=PARTICLESTREAMSPEC::ATM_PLIN;
		else if (!strcmp(cbuf,"ATM_PLOG"))
			ps->atmsmap=PARTICLESTREAMSPEC::ATM_PLOG;
		else
			ps->atmsmap=PARTICLESTREAMSPEC::ATM_PLOG;
		sprintf(str,"P_%d_tex",i+1);
		g_FR.LoadString(ini,"SETTINGS",str,cbuf);
		if (strcmp(cbuf,"none"))
		{
			SURFHANDLE texture = oapiRegisterExhaustTexture(cbuf);
			ps->tex=texture;
		}
		vis = new PVISUAL(ps,pos);
		visuals.push_back(vis);
	}
	g_FR.LoadString(ini,"SETTINGS","sound",cbuf);
	if (!strcmp("default",cbuf))
		sprintf(vbj->sound,"Sound/Vessel/sonicbang.wav");
	else
		sprintf(vbj->sound,"%s",cbuf);
	g_FR.LoadDouble(ini,"SETTINGS","duration",vbj->duration);
	vbj->hook=v->GetHandle();
	vbj->streams=visuals;
	CreateResourceAndStreams(vbj);
	return vbj;
}
I can't figure it, but something here is not working with 2010 (from 2006)
(Thanks for the code Computerex)
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
Does it "hang" in the presented function, or later in Orbiter's internal code? Without seeing bodies of (locally defined) functions being called, I can't tell. The function itself could hang if 'i' variable was modified inside the loop, which I can't see being done, or if one of called functions had an infinite loop.
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
I've attached the original zip from computerex, if you have the time to take a look.

All I'm trying to do is make it 2010 compatible...
I have only made very few changes so far just to get it to compile and run.

Apart from what you see in BOOMMANAGER2.cpp, I only commented out VOBJ* ReadAndAssign(char * file, VESSEL * v); in BOOMMANAGER.h to comply,

changed ref #include <OrbiterSoundSDK40.h>,

and commented out atList.push_back(ReadAndAssign(ini,v)); in void BOOMMANAGER::TimeStep(void)

Orbiter runs with the section VOBJ * BOOMMANAGER::ReadAndAssign(char * ini, VESSEL * v) that I first posted commented out and this configuration (but with no effect, naturally), just to try to isolate what's causing the hang.
Thanks in anticipation.
JMW
 
Last edited:
Top