Exemple #1
0
void Field::StartBurn(uchar size, uchar id,uchar direction)
{
	hasbomb=false;
	switch(type)
	{
	case 2:
		burning=true;
		if(bonus)
		{
			bonus->Destroy();
			bonus=0;
		}
		this->id=id;
		break;
	case 3:
		this->type=1;
		emit FieldChanged(this->x,this->y,this->type);
		break;
	case 1:
		this->type=2;
		emit FieldChanged(this->x,this->y,this->type);
		if(bonus)bonus->TurnVisible();
		break;
	}
	QTimer::singleShot(300,this,SLOT(Extinction()));

    emit Boomed(x,y,size,id,size==0 ? direction+16 :direction);

    if( size==0 || !burning)return;

    if((direction==0 || direction==255) && left!=0 && (left->IsPermeable() || left->IsBlastable())){left->StartBurn(size-1,id,0);}
    if((direction==1 || direction==255) && top!=0 && (top->IsPermeable() || top->IsBlastable())){top->StartBurn(size-1,id,1);}
    if((direction==2 || direction==255) && bottom!=0 && (bottom->IsPermeable() || bottom->IsBlastable())){bottom->StartBurn(size-1,id,2);}
    if((direction==3 || direction==255) && right!=0 && (right->IsPermeable() || right->IsBlastable())){right->StartBurn(size-1,id,3);}

}
Exemple #2
0
int calc_atten_lum(int argc, void *argv[])
{
	int N;
	float Band_L;
	float L_lambda = 14.0; //An example L_lambda in Lsun micron^-1
	float lambda = 0.5;//an example wavelength in microns
	float Z    = 0.1; //an example metallicity in solar units
	float NH   = 21.0; // an example column density
	float *iLum;
	float *iNH;
	float *iZ;
	float *Value;
	float *vv;
	float Ext, NewLum;
	int i;


	if(argc!=6)
	    {
	      fprintf(stderr,"\n\nwrong number of arguments ! (found %d) \n\n",argc);
	      exit(0);
	    }


	N	=*(int *)argv[0];
	Band_L  =*(float *)argv[1];
	iLum	=(float*)argv[2];
	iNH	=(float*)argv[3];
	iZ	=(float*)argv[4];
	Value	=(float*)argv[5];

	Initialize();

	lambda= Band_L/1.0e4;

	printf("Determine Attenuation, N=%d\n",N);
	printf("Band_L=%g   lambda= %g\n",Band_L,lambda);

	for(i=0;i<N;i++)
	{
		if(!(i%10000))
		    printf("%d..",i);

		L_lambda = log10(iLum[i]);
		NH = log10(iNH[i]);
		Z = iZ[i];
		Ext = Extinction(lambda,NH,Z);
		NewLum= pow(10.0, L_lambda + Ext);
/*
if(i<5){
printf("i= %d   iLum[%d]= %g  iNH[%d]= %g  Ext= %g  NewLum %g\n",i,i,iLum[i],i,iNH[i],Ext,NewLum); fflush(stdout);
}
*/
		vv = Value + i;
		*vv = NewLum;
/*
		*vv = pow(10.0, L_lambda+IA.Extinction(lambda,NH,Z));
		*vv = 10.0;
*/
	}

	printf("... done\n");
	fflush(stdout);


	FreeMemory();

	return 0;
}