Example #1
0
/*{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}
* Name: SH_Mngr
* Desc: Run Soil simulation. Will run the Duff or the Exp simulation
*        code, based on presence of Duff.
* Note Duff Sim:
*        The Fuel has to be run before coming here, because the Fuel
*        calculates the Post Duff Depth which DUff Sim needs to run.
* Note Exp Heat:
*        The Fuel has to be run before coming here, which should
*        have detected the no Duff Depth/Load and run burnup which calculates
*        the heat and time need by Exp Heat.
* Note-1: There use to be some Error_Window() type logic errors in the
*          soil code, it would have been hard and not worth it to do them
*          thru the functions so I did a global string.
*   In: a_SI......
*
*  Ret: 1 Ok,   0 Error
{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{**/
int WINAPI  SH_Mngr (d_SI *a_SI, d_SO *a_SO, char cr_TmpFN[], char cr_ErrMes[])
{
d_SD s_SD;
d_SE s_SE;
char cr[40];

  strcpy (gcr_SoiErr,"");
  SO_Init (a_SO);                            /* Init the output struct       */

  if ( !xstrcmpi(a_SI->cr_BrnIg,"NO")) {      /* Burnup ran & didn't ignite   */
    SHA_Init_0 ();                           /* so 0 out this arrary so that */
    return 1; }                              /* 0s come out in the report    */

  SHA_Init ();                               /* Init the Soil Heat Temp Array*/

  if ( a_SI->f_DufDepPre > 0 )               /* Prefire Duff depth determines*/
     goto DuffSim;                           /* if we run Duff or Exp simulat*/

/*.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*/
/* Do the Exp Heat, because there is no duff depth                           */
  strcpy (a_SO->cr_Model,e_SM_ZDuff);           /* tells what soil model     */

  if ( !SE_Init (a_SI, &s_SE, cr_ErrMes))       /* Ready the SE input struct */
     return 0;

  if ( !SE_Mngr (&s_SE,cr_TmpFN,cr_ErrMes))     /* Run it, makes Pt arrar& File */
     return 0;

  goto Load;

/*.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*/
/* Do the Duff Simulation Modes                                              */
DuffSim:
  strcpy (a_SO->cr_Model,e_SM_Duff);

  if ( !SD_ChkSoiDuf(a_SI->f_DufDepPre, a_SI->f_DufDepPos, cr_ErrMes) )
    return 0;

  if ( !SD_Init (&s_SD, a_SI, cr_ErrMes))
     return 0;

/* Duff Sim is done when there is a Duff Depth to use....................... */
  if ( !SD_Mngr(&s_SD,cr_TmpFN,cr_ErrMes))   /* Run Soil Duff Simulation     */
    return 0;

Load:
  SO_Load (a_SI, a_SO);                      /* Get Soil Outputs             */
  if ( strcmp (gcr_SoiErr,"") ) {            /* See Note-1 above             */
     strcpy (cr_ErrMes,gcr_SoiErr);
     return 0; }
  return 1;
}
Example #2
0
void Com_Init( char *commandLine ) {
	char	*s;

	Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );

	try {
		Cvar_Init ();

		// prepare enough of the subsystems to handle
		// cvar and command buffer management
		Com_ParseCommandLine( commandLine );

		//Swap_Init ();
		Cbuf_Init ();

		Com_InitZoneMemory();

		Cmd_Init ();

		// override anything from the config files with command line args
		Com_StartupVariable( NULL );

		// done early so bind command exists
		CL_InitKeyCommands();

		com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT);

		FS_InitFilesystem ();	//uses z_malloc
		//re.R_InitWorldEffects();   // this doesn't do much but I want to be sure certain variables are intialized.
		
		Com_ExecuteCfg();

		// override anything from the config files with command line args
		Com_StartupVariable( NULL );
		
		// allocate the stack based hunk allocator
		Com_InitHunkMemory();

		// if any archived cvars are modified after this, we will trigger a writing
		// of the config file
		cvar_modifiedFlags &= ~CVAR_ARCHIVE;
		
		//
		// init commands and vars
		//
		Cmd_AddCommand ("quit", Com_Quit_f);
		Cmd_AddCommand ("writeconfig", Com_WriteConfig_f );
		
		com_maxfps = Cvar_Get ("com_maxfps", "125", CVAR_ARCHIVE);
		
		com_developer = Cvar_Get ("developer", "0", CVAR_TEMP );
		com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP );
		com_speedslog = Cvar_Get ("speedslog", "0", CVAR_TEMP );
		
		com_timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT );
		com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT);
		com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT);
		com_speeds = Cvar_Get ("com_speeds", "0", 0);
		
#ifdef G2_PERFORMANCE_ANALYSIS
		com_G2Report = Cvar_Get("com_G2Report", "0", 0);
#endif

		cl_paused	   = Cvar_Get ("cl_paused", "0", CVAR_ROM);
		sv_paused	   = Cvar_Get ("sv_paused", "0", CVAR_ROM);
		com_sv_running = Cvar_Get ("sv_running", "0", CVAR_ROM);
		com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM);
		com_skippingcin = Cvar_Get ("skippingCinematic", "0", CVAR_ROM);
		com_buildScript = Cvar_Get( "com_buildScript", "0", 0 );

		com_affinity = Cvar_Get( "com_affinity", "1", CVAR_ARCHIVE );

		com_bootlogo = Cvar_Get( "com_bootlogo", "1", CVAR_ARCHIVE );
		
		if ( com_developer && com_developer->integer ) {
			Cmd_AddCommand ("error", Com_Error_f);
			Cmd_AddCommand ("crash", Com_Crash_f );
			Cmd_AddCommand ("freeze", Com_Freeze_f);
		}
		
		s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ );
		com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );

#ifdef JK2_MODE
		JK2SP_Init();
		Com_Printf("Running Jedi Outcast Mode\n");
#else
		SE_Init();	// Initialize StringEd
		Com_Printf("Running Jedi Academy Mode\n");
#endif
	
		Sys_Init();	// this also detects CPU type, so I can now do this CPU check below...

		Sys_SetProcessorAffinity();

		Netchan_Init( Com_Milliseconds() & 0xffff );	// pick a port value that should be nice and random
//	VM_Init();
		SV_Init();
		
		CL_Init();
		
		// set com_frameTime so that if a map is started on the
		// command line it will still be able to count on com_frameTime
		// being random enough for a serverid
		com_frameTime = Com_Milliseconds();

		// add + commands from command line
		if ( !Com_AddStartupCommands() ) {
			// if the user didn't give any commands, run default action
			if ( com_bootlogo->integer )
			{
				Cbuf_AddText ("cinematic openinglogos\n");
			}
		}
		com_fullyInitialized = qtrue;
		Com_Printf ("--- Common Initialization Complete ---\n");

//HACKERY FOR THE DEUTSCH		
		//if ( (Cvar_VariableIntegerValue("ui_iscensored") == 1) 	//if this was on before, set it again so it gets its flags
		//	)
		//{
		//	Cvar_Get( "ui_iscensored",   "1", CVAR_ARCHIVE|CVAR_ROM|CVAR_INIT|CVAR_CHEAT|CVAR_NORESTART);
		//	Cvar_Set( "ui_iscensored",   "1");	//just in case it was archived
		//	// NOTE : I also create this in UI_Init()
		//	Cvar_Get( "g_dismemberment", "0", CVAR_ARCHIVE|CVAR_ROM|CVAR_INIT|CVAR_CHEAT);
		//	Cvar_Set( "g_dismemberment", "0");	//just in case it was archived
		//}
	}
	catch ( int code )
	{
		Com_CatchError (code);
		Sys_Error ("Error during initialization %s", Com_ErrorString (code));
	}
}