//
// SDK.VSU_gas_t.c
//
char VSU_gas_t_gauge_name[]		= GAUGE_NAME;
extern PELEMENT_HEADER		VSU_gas_t_list;
extern MOUSERECT			VSU_gas_t_mouse_rect[];

GAUGE_HEADER_FS700(GAUGE_W, VSU_gas_t_gauge_name, &VSU_gas_t_list, \
						VSU_gas_t_mouse_rect, 0, 0, 0, 0);

/////////////////////////////////////////////////////////////////////////////
FAILURE_RECORD	VSU_gas_t_fail[] =
{
	{FAIL_SYSTEM_ELECTRICAL_PANELS, FAIL_ACTION_NO_DRAW},
	{FAIL_NONE, FAIL_ACTION_NONE}
};

/////////////////////////////////////////////////////////////////////////////
FLOAT64 FSAPI	VSU_gas_t_string_cb( PELEMENT_STRING pelement )
{	
	lookup_var(&TEMP_DEGREES_Cvar);
	if (start_vsu == 1 ){
		if ( Gas_t >= 0 &&  Gas_t <= 200) { 
			Gas_t += 2 ;
		}
		if ( Gas_t > 200 && Gas_t <= 400 ) { 
			Gas_t += 1 ;
		}
		if ( Gas_t > 400 && Gas_t <= 600) { 
			Gas_t += 0.8;
		}
		if ( Gas_t > 600 && Gas_t <= 680) { 
			Gas_t += 0.4;
		}
		if (Gas_t > 680 ) {
			Gas_t = 700;
		}
	}
	if (start_vsu == 0 ) {
		if ( Gas_t >= 400) { 
			Gas_t -= 1;
		}
		if ( Gas_t < 400 && Gas_t >= 150) { 
			Gas_t -= 0.5;
		}
		if ( Gas_t < 150 && Gas_t > TEMP_DEGREES_Cvar.var_value.n) { 
			Gas_t -= 0.1;
		}
		if (Gas_t < TEMP_DEGREES_Cvar.var_value.n) {
			Gas_t = TEMP_DEGREES_Cvar.var_value.n;
		}
	}
	sprintf(pelement->string ,"%03d", (UINT32)Gas_t);

	return Gas_t;
}

MAKE_STRING
(
	VSU_gas_t_string,
	NULL,
	VSU_gas_t_fail,
	IMAGE_USE_ERASE | IMAGE_USE_BRIGHT | IMAGE_USE_TRANSPARENCY,
	0,
	8, 1,
	90, 55,
	3,

	MODULE_VAR_NONE,
	MODULE_VAR_NONE,
	MODULE_VAR_NONE,
	RGB(139,149,90),
	RGB(0,0,0),
	RGB(92,92,92),
	GAUGE_FONT_DEFAULT,
	GAUGE_WEIGHT_DEFAULT,
	GAUGE_CHARSET,
	0,
	DT_CENTER | DT_VCENTER | DT_SINGLELINE,
	NULL,
	VSU_gas_t_string_cb
)

PELEMENT_HEADER		VSU_gas_t_icon_list[] =
{
	&VSU_gas_t_string.header,
	NULL
};


/////////////////////////////////////////////////////////////////////////////
MAKE_STATIC
(
	VSU_gas_t_background,
	BMP_STRING_BG,
	&VSU_gas_t_icon_list,
	NULL,
	IMAGE_USE_TRANSPARENCY,
	0,
	0,0
)

PELEMENT_HEADER		VSU_gas_t_list	= &VSU_gas_t_background.header;


MOUSE_BEGIN( VSU_gas_t_mouse_rect, HELP_NONE, 0, 0 )
MOUSE_END


/////////////////////////////////////////////////////////////////////////////
#undef GAUGE_NAME
#undef GAUGEHDR_VAR_NAME
#undef GAUGE_W
#undef GAUGE_CHARSET
#undef GAUGE_FONT_DEFAULT
#undef GAUGE_WEIGHT_DEFAULT


