//
// VSU_oil_T.c
//
char	 VSU_oil_T_gauge_name[]		= GAUGE_NAME;
extern	 PELEMENT_HEADER			VSU_oil_T_list;
extern	 MOUSERECT					VSU_oil_T_mouse_rect[];

GAUGE_HEADER_FS700(GAUGE_W, VSU_oil_T_gauge_name, &VSU_oil_T_list, \
						VSU_oil_T_mouse_rect, 0, 0, 0, 0);

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

/////////////////////////////////////////////////////////////////////////////
FLOAT64 FSAPI	VSU_oil_T_string_cb( PELEMENT_STRING pelement )
{
	lookup_var(&TEMP_DEGREES_Cvar);
	if (start_vsu == 1 ){
		if ( Oil_t >= 0 &&  Oil_t <= 30) { 
			Oil_t += 0.8 ;
		}
		if ( Oil_t > 30 && Oil_t <= 70 ) { 
			Oil_t += 0.7 ;
		}
		if ( Oil_t > 70 && Oil_t <= 120) { 
			Oil_t += 0.3;
		}
		if ( Oil_t > 120 && Oil_t <= 140) { 
			Oil_t += 0.1;
		}
		if (Oil_t > 150 ) {
			Oil_t = 150;
		}
	}
	if (start_vsu == 0 ) {
		if ( Oil_t >= 130) { 
			Oil_t -= 1;
		}
		if ( Oil_t < 130 && Oil_t >= 70) { 
			Oil_t -= 0.5;
		}
		if ( Oil_t < 70 && Oil_t >  TEMP_DEGREES_Cvar.var_value.n) { 
			Oil_t -= 0.1;
		}
		if (Oil_t < TEMP_DEGREES_Cvar.var_value.n) {
			Oil_t = TEMP_DEGREES_Cvar.var_value.n;
		}
	}
	sprintf(pelement->string ,"%03d", (UINT32)Oil_t);

	return Oil_t;
}

MAKE_STRING
(
	VSU_oil_T_string,
	NULL,
	VSU_oil_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_oil_T_string_cb
)

PELEMENT_HEADER		VSU_oil_T_icon_list[] =
{
	&VSU_oil_T_string.header,
	NULL
};


/////////////////////////////////////////////////////////////////////////////
MAKE_STATIC
(
	VSU_oil_T_background,
	BMP_STRING_BG,
	&VSU_oil_T_icon_list,
	NULL,
	IMAGE_USE_TRANSPARENCY,
	0,
	0,0
)

PELEMENT_HEADER		VSU_oil_T_list	= &VSU_oil_T_background.header;


MOUSE_BEGIN( VSU_oil_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


