예제 #1
0
파일: variables.c 프로젝트: sklnd/vifm
void init_variables(var_print handler)
{
	int i;
	extern char **environ;

	print_func = handler;

	if(nvars > 0)
		clear_variables();

	/* count environment variables */
	i = 0;
	while(environ[i] != NULL)
		i++;

	/* allocate memory for environment variables */
	vars = malloc(sizeof(*vars)*i);
	assert(vars != NULL);

	/* initialize variable list */
	i = 0;
	while(environ[i] != NULL)
	{
		init_var(environ[i]);
		i++;
	}

	initialized = 1;
}
예제 #2
0
int				ft_write_piece(char **s, t_point *p, char tag, int size)
{
	int		i;
	int		j;
	int		x_y;

	init_var(&i, &j, &x_y);
	while (j < size)
	{
		while (i < size)
		{
			if (p->y[x_y] == j && p->x[x_y] == i)
			{
				s[j][i] = tag;
				x_y++;
			}
			else
				line_saver(s, &i, &j);
			i++;
		}
		j++;
		i = 0;
	}
	s[j] = NULL;
	return (0);
}
예제 #3
0
char	*_op_sub(char *tab[2], t_base *base, char ops[7], int len[2])
{
  char	*buff;
  int	i;
  int	ret;
  int	tmp;

  buff = xmalloc((MAX(len[0], len[1]) + 3) * sizeof(char));
  my_memset(buff, 0x0, MAX(len[0], len[1]) + 3);
  init_var(&i, &ret, &tmp);
  while (len[0] >= min_ref(tab[0], ops) || len[1] >= min_ref(tab[1], ops))
  {
    if (len[0] >= min_ref(tab[0], ops) && len[1] >= min_ref(tab[1], ops))
      tmp = base->value[tab[0][len[0]]] - base->value[tab[1][len[1]]] - ret;
    else if (len[0] >= min_ref(tab[0], ops))
      tmp = base->value[tab[0][len[0]]] - ret;
    ret = (tmp < 0);
    if (tmp < 0)
      tmp += base->length;
    buff[i++] = get_char_for_value(tmp % base->length, base);
    --len[0];
    --len[1];
  }
  if (ret > 0)
    buff[i++] = get_char_for_value(ret % base->length, base);
  return (my_revstr(my_strdup(buff)));
}
예제 #4
0
void		print_game(int *tab)
{
  t_game	da;

  init_var(&da.i, &da.a, &da.c);
  while (da.i < 4)
    {
      da.u = 0;
      my_putchar('*');
      while ((da.u++ < da.a) && (da.u < da.c))
	  my_putchar(' ');
      da.v = da.u;
      if (da.u < da.c)
	while (da.u < tab[da.i] + da.v)
	  {
	    my_putchar('|');
	    da.u++;
	  }
      while (da.u < da.c + 1)
	{
	  my_putchar(' ');
	  da.u++;
	}
      init_var2(&da.i, &da.a);
    }
  my_putstr("*********\n");
}
예제 #5
0
int				ft_check_x(char **s, t_point *p, int size)
{
	int		i;
	int		j;
	int		x_y;

	init_var(&i, &j, &x_y);
	while (j < size)
	{
		while (i < size)
		{
			if ((p->y[x_y] < 0 || p->x[x_y] < 0) && (x_y < 4))
				return (-1);
			if (p->y[x_y] == j && p->x[x_y] == i)
			{
				if (s[j][i] >= 'A' && s[j][i] <= 'Z')
					return (-1);
				x_y++;
			}
			i++;
		}
		j++;
		if (j < size)
			i = 0;
	}
	return (0);
}
예제 #6
0
int		what_to_print(const char *format, va_list *arg)
{
	char					*text;
	int						size;
	t_mod					data;
	char					*choped;
	unsigned long int		i;
	
	text = NULL;
	init_var(&i, &size);
	while (++i < ft_strlen(format))
	{
		if (format[i] == '%')
		{
			choped = ft_strdup(chop_format(format, &i));
			process_flags(choped, &data);
			start_engine(text, &size, &data, arg);
			i = i + ft_strlen(choped);
		}
		else
		{
			ft_putchar(format[i]);
			size++;
		}
	}
	return (size);
}
예제 #7
0
int	find_a(t_dlist *list)
{
  t_list	*tmp;
  t_var		var;
  t_list        *tmp2;

  tmp = list->begin;
  while (tmp)
    {
      init_var(&var);
      if (my_strcmp(tmp->arg, "-a") == 0)
	{
	  var.a++;
	  if (tmp->next == NULL || valid_a(tmp->next->arg) != 0)
	    my_puterror("-a");
	  tmp = tmp->next->next;
	  tmp2 = tmp;
	  while (my_strcmp(is_cor(tmp2->arg), ".cor") != 0)
	    {
	      search_cor_a(tmp2, &(var.a), &(var.n), &(var.d));
	      tmp2 = tmp2->next;
	    }
	  return (0);
	}
      tmp = tmp->next;
    }
  return (0);
}
예제 #8
0
t_point			*ft_store_piece(char **splited_file)
{
	int		i;
	int		j;
	int		p;
	int		count;
	t_point	*piece;

	init_var(&i, &j, &p, &count);
	if (!splited_file)
		return (NULL);
	if (!(piece = (t_point*)malloc(sizeof(*piece))))
		return (NULL);
	while (j < 4)
	{
		while (splited_file[j][i] != '\0' && splited_file[j][i] != '#')
			i++;
		if (splited_file[j][i] == '#')
		{
			piece->y[p] = j;
			piece->x[p++] = i++;
		}
		else
			line_saver(&j, &count, &i);
	}
	return (piece);
}
예제 #9
0
파일: variables.c 프로젝트: ackeack/workenv
void
init_variables(void)
{
	int env_count;
	extern char **environ;

	if(nvars > 0)
		clear_variables();

	/* count environment variables */
	env_count = 0;
	while(environ[env_count] != NULL)
		env_count++;

	if(env_count > 0)
	{
		int i;

		/* allocate memory for environment variables */
		vars = malloc(sizeof(*vars)*env_count);
		assert(vars != NULL);

		/* initialize variable list */
		i = 0;
		while(environ[i] != NULL)
		{
			init_var(environ[i]);
			i++;
		}
	}

	init_parser(&local_getenv);

	initialized = 1;
}
예제 #10
0
/*!
 * \brief DialogSettings::DialogSettings
 * \param parent
 *
 * DialogSettings
 */
DialogSettings::DialogSettings(QWidget *parent) :
    QDialog(parent)
{
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    init_var();
    init_win();
    init_sig();
    init_css();

    init_settings();
}
예제 #11
0
파일: main.c 프로젝트: mishevious/Project
int		main(int ac, char **av)
{
	t_env	e;

	init_var(&e);
	if (ac == 1)
		init_path(&e);
	else
		parser(ac, av, &e, 1);
	if (e.nb_path == 0)
		return (0);
	init_var2(&e);
	get_data(&e);
	return (0);
}
예제 #12
0
bool Form1::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: init_var(); break;
    case 1: btnConnect_clicked(); break;
    case 2: onReceive(); break;
    case 3: btnInit_clicked(); break;
    case 4: btnSave_clicked(); break;
    case 5: languageChange(); break;
    case 6: onTimer(); break;
    default:
	return QDialog::qt_invoke( _id, _o );
    }
    return TRUE;
}
예제 #13
0
int			main()
{
  t_variable		var;

  init_var(&var, laby);
  trace(&var);
  mlx_expose_hook(var.win_ptr, refresh, &var);
  mlx_hook(var.win_ptr, KeyPress, KeyPressMask, key, &var);
  mlx_hook(var.win_ptr, ButtonPress, ButtonPressMask, gun, &var);
  mlx_hook(var.win_ptr, MotionNotify, PointerMotionMask, mouse, &var);
  if (var.fd != -1)
    joystick(&var);
  else
    mlx_loop(var.mlx_ptr);
  return (0);
}
예제 #14
0
파일: estimate.c 프로젝트: Rygbee/ctm-c
void expectation(corpus* corpus, llna_model* model, llna_ss* ss,
                 double* avg_niter, double* total_lhood,
                 gsl_matrix* corpus_lambda, gsl_matrix* corpus_nu,
                 gsl_matrix* corpus_phi_sum,
                 short reset_var, double* converged_pct)
{
    int i;
    llna_var_param* var;
    doc doc;
    double lhood, total;
    gsl_vector lambda, nu;
    gsl_vector* phi_sum;

    *avg_niter = 0.0;
    *converged_pct = 0;
    phi_sum = gsl_vector_alloc(model->k);
    total = 0;
    for (i = 0; i < corpus->ndocs; i++)
    {
        printf("doc %5d   ", i);
        doc = corpus->docs[i];
        var = new_llna_var_param(doc.nterms, model->k);
        if (reset_var)
            init_var_unif(var, &doc, model);
        else
        {
            lambda = gsl_matrix_row(corpus_lambda, i).vector;
            nu= gsl_matrix_row(corpus_nu, i).vector;
            init_var(var, &doc, model, &lambda, &nu);
        }
        lhood = var_inference(var, &doc, model);
        update_expected_ss(var, &doc, ss);
        total += lhood;
        printf("lhood %5.5e   niter %5d\n", lhood, var->niter);
        *avg_niter += var->niter;
        *converged_pct += var->converged;
        gsl_matrix_set_row(corpus_lambda, i, var->lambda);
        gsl_matrix_set_row(corpus_nu, i, var->nu);
        col_sum(var->phi, phi_sum);
        gsl_matrix_set_row(corpus_phi_sum, i, phi_sum);
        free_llna_var_param(var);
    }
    gsl_vector_free(phi_sum);
    *avg_niter = *avg_niter / corpus->ndocs;
    *converged_pct = *converged_pct / corpus->ndocs;
    *total_lhood = total;
}
예제 #15
0
파일: main.c 프로젝트: tlepeche/Projets
int		main(int ac, char **av)
{
	t_env	e;

	init_var(ac, av, &e);
	e.mlx = mlx_init();
	if (e.mlx == NULL)
		exit(0);
	e.win = mlx_new_window(e.mlx, W_WIDTH, W_HEIGHT, "Fract'ol");
	e.img = mlx_new_image(e.mlx, W_WIDTH, W_HEIGHT);
	e.data = mlx_get_data_addr(e.img, &e.bpp, &e.sl, &e.endian);
	mlx_hook(e.win, MotionNotify, PointerMotionMask, mouse_move, &e);
	mlx_expose_hook(e.win, expose_hook, &e);
	mlx_mouse_hook(e.win, mouse_hook, &e);
	mlx_key_hook(e.win, key_hook, &e);
	mlx_loop(e.mlx);
	return (0);
}
예제 #16
0
int main (void)
{	
	board_init();
	init_sensor_interrupts();
	init_joystick();
	init_timer0();
	init_serial_stdio(9600,0);
	init_var();
	struct Motor* A = malloc(sizeof(Motor));
	struct Motor* B = malloc(sizeof(Motor));
	A->pos = 0;
	B->pos = 0;
	A->ID = 0;
	B->ID = 1;
	sei();
	printf_P(PSTR("WOOP------------------------------------------------------------------------------\n"));
	clear_terminal();
	
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//                                          uSEFUL cODE                                                       //                                                                  
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	//To test the sensors are working
	//banana();
	
	//Seminar demo code
	//DEMO(A,B);
	
	//To test the motors are working
	//Azathoth(A,B);
	
	//To test beta pan function
	//qwert(A,B);
	
	//Tuesday test code
	// Pin C0 acts as sensor input
	//  Pins D0-D7 run the motors
	//  Pin C1 is the Emitter control 
	//  Pin C2 is the Magnet Control */
		
	Nyarlathotep(A,B);
	
	return 0;
}
예제 #17
0
파일: ft_see.c 프로젝트: jdG-/zap
void			ft_see(t_cmd *cmd, t_game *g)
{
	t_var	var;
	char	*msg;
	char	*del;

	msg = NULL;
	var = init_var(g, cmd);
	msg = check_case(g, var, msg, 1);
	var.i = 1;
	del = msg;
	msg = ft_strtrim(msg);
	free(del);
	msg = ft_strjoin_free("{", msg, 2);
	msg = ft_strjoin_free(msg, ",", 1);
	ft_while(g, cmd, var, &msg);
	msg = ft_strjoin_free(msg, "}", 1);
	ft_putendl_fd(msg, cmd->fd);
}
예제 #18
0
DialogFlowConstructorEPI::DialogFlowConstructorEPI(Coord **coords_arterial, Coord **coords_venous, Coord **coords_csf,
                                             QStringList *list_arterial, QStringList *list_venous, QStringList *list_csf,
                                             Coord *coord_arterial_cervical, Coord *coord_venous_cervical, Coord *coord_csf_cervical,
                                             QStringList *list_arterial_cervical, QStringList *list_venous_cervical, QStringList *list_csf_cervical,
                                             Coord *coord_arterial_cerebral, Coord *coord_venous_cerebral, Coord *coord_csf_cerebral,
                                             QStringList *list_arterial_cerebral, QStringList *list_venous_cerebral, QStringList *list_csf_cerebral,
                                             QWidget *parent) :
    QDialog(parent)
{
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    //Address copy
    this->coords_arterial = coords_arterial;
    this->coords_venous = coords_venous;
    this->coords_csf = coords_csf;

    this->coord_arterial_cervical = coord_arterial_cervical;
    this->coord_venous_cervical = coord_venous_cervical;
    this->coord_csf_cervical = coord_csf_cervical;
    this->coord_arterial_cerebral = coord_arterial_cerebral;
    this->coord_venous_cerebral = coord_venous_cerebral;
    this->coord_csf_cerebral = coord_csf_cerebral;

    this->list_arterial = list_arterial;
    this->list_venous = list_venous;
    this->list_csf = list_csf;

    this->list_arterial_cervical = list_arterial_cervical;
    this->list_venous_cervical = list_venous_cervical;
    this->list_csf_cervical = list_csf_cervical;

    this->list_arterial_cerebral = list_arterial_cerebral;
    this->list_venous_cerebral = list_venous_cerebral;
    this->list_csf_cerebral = list_csf_cerebral;

    init_var();
    init_win();
    init_sig();
    init_css();
}
예제 #19
0
BOOL CKInputDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	TCHAR* date_format=_T("yyyy'-'MM'-'dd");

	init_var();

	m_ngay.SetFormat(date_format);
	m_ngayKT.SetFormat(date_format);

	create_flags();
	//an cac ctrl ko dung va set label cho các edit
	hideCtrl();
	set_comment();
	//set total row va tao col cho list view
	create_list_cols();
	m_resList.SetExtendedStyle(m_resList.GetExtendedStyle() 
		| LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
예제 #20
0
int					my_printf(t_params *params, t_args *args)
{
	t_tabvar		var;
	int				i;
	int				j;
	int				count;

	i = 0;
	j = 0;
	count = 0;
	init_var(&var);
	while (g_tab[i].i != params->specifier && i <= SPECIFIER)
		i++;
	if (i > SPECIFIER)
		return (-1);
	if (params->lenght == LENGHT)
		if (i < SPECIFIER)
			return (count + g_tab[i].f(params, args, &var));
	while (g_lght[j].j != params->lenght)
		j++;
	return (count + g_lght[j].f(i, args, &var, params));
}
예제 #21
0
파일: search_quake.c 프로젝트: Mthomas3/BSQ
int		search_quake(char **tab, int len, int line, t_quake *quake)
{
  if (!(quake->tab_int = init_tab(len)))
    exit(0);
  init_var(quake);
  while (++quake->y < line)
    {
      quake->x = -1;
      convert(quake->tab_int[1], tab[quake->y], len);
      while (++quake->x < len)
	{
	  if (quake->tab_int[1][quake->x] > 0 && quake->y > 0)
	    quake->tab_int[1][quake->x] = get_min(quake->x, quake->tab_int) + 1;
	  if (quake->tab_int[1][quake->x] > quake->size)
	    my_quake(quake);
	}
      quake->x = -1;
      while (++quake->x < len)
	quake->tab_int[0][quake->x] = quake->tab_int[1][quake->x];
    }
  my_result(tab, quake->x_gauche, quake->y_gauche, quake->size);
  return (0);
}
예제 #22
0
int		main(int ac, char **av)
{
  Sondage	sondage;
  int		check;

  if (ac != 4)
    {
      std::cout << USAGE << std::endl;
      return (1);
    }
  if ((check = init_var(&sondage, av)) != 0)
    {
      if (check == 1)
	std::cout << USAGE_VOTE << std::endl;
      if (check == 2)
	std::cout << USAGE_NULL << std::endl;
      if (check == 3)
	std::cout << USAGE_POP << std::endl;
      return (1);
    }
  main_loop(&sondage);
  return (0);
}
예제 #23
0
파일: juego.c 프로젝트: benoror/gbadev
void Main()
{
    u16 i,j,boton,ok=0;

    init_props_map();

REINICIA:
    init_var();

    while(1) {
        j++;

        boton=joypad();
        if(!(boton & J_A)) retraso=10;
        if((boton & J_A)) retraso=50;

        pieza(pzY[0],pzY[1],pzY[2],pzY[3],pzY[4],pzY[5],a0_,a1_,a2_,a3_,a4_,a5_);

        if(j>=retraso) {
            if((pzY[0]<mapV[0].y-pz_alto) && a0_!=0) {
                pzY[0]++;
                j=0;
            }
            else if((pzY[0]>=mapV[0].y-pz_alto) && a0_!=0) {
                mapV[0].y-=16;
                ok++;
            }
            if((pzY[1]<mapV[1].y-pz_alto) && a1_!=0) {
                pzY[1]++;
                j=0;
            }
            else if((pzY[1]>mapV[1].y-pz_alto) && a1_!=0)  {
                mapV[1].y-=16;
                ok++;
            }
            if((pzY[2]<mapV[2].y-pz_alto) && a2_!=0) {
                pzY[2]++;
                j=0;
            }
            else if((pzY[2]>mapV[2].y-pz_alto) && a2_!=0)  {
                mapV[2].y-=16;
                ok++;
            }
            if((pzY[3]<mapV[3].y-pz_alto) && a3_!=0) {
                pzY[3]++;
                j=0;
            }
            else if((pzY[3]>mapV[3].y-pz_alto) && a3_!=0)  {
                mapV[3].y-=16;
                ok++;
            }
            if((pzY[4]<mapV[4].y-pz_alto) && a4_!=0) {
                pzY[4]++;
                j=0;
            }
            else if((pzY[4]>mapV[4].y-pz_alto) && a4_!=0)  {
                mapV[4].y-=16;
                ok++;
            }
            if((pzY[5]<mapV[5].y-pz_alto) && a5_!=0) {
                pzY[5]++;
                j=0;
            }
            else if((pzY[5]>mapV[5].y-pz_alto) && a5_!=0)  {
                mapV[5].y-=16;
                ok++;
            }

            if(ok>=6) {
                goto REINICIA;
                ok=0;
            }
        }

        wait_vbl_done();
    }
}
예제 #24
0
파일: var.c 프로젝트: adamdempsey90/fargo3d
void InitVariables() {
  init_var("FLARINGINDEX", (char*)&FLARINGINDEX, REAL, NO, "0.0");
  init_var("SIGMASLOPE", (char*)&SIGMASLOPE, REAL, NO, "0.5");
  init_var("YMAX", (char*)&YMAX, REAL, NO, "100.0");
  init_var("THICKNESSSMOOTHING", (char*)&THICKNESSSMOOTHING, REAL, NO, "0.6");
  init_var("OMEGAFRAME", (char*)&OMEGAFRAME, REAL, NO, "1.0005");
  init_var("DT", (char*)&DT, REAL, NO, "1200.0");
  init_var("ROCHESMOOTHING", (char*)&ROCHESMOOTHING, REAL, NO, "0.0");
  init_var("XMIN", (char*)&XMIN, REAL, NO, "-3.14159265358979323844");
  init_var("XMAX", (char*)&XMAX, REAL, NO, "3.14159265358979323844");
  init_var("ECCENTRICITY", (char*)&ECCENTRICITY, REAL, NO, "0.0");
  init_var("ALPHA", (char*)&ALPHA, REAL, NO, "0.001");
  init_var("ASPECTRATIO", (char*)&ASPECTRATIO, REAL, NO, "0.05");
  init_var("YMIN", (char*)&YMIN, REAL, NO, "10.0");
  init_var("SIGMA0", (char*)&SIGMA0, REAL, NO, "1.0");
  init_var("GAMMA", (char*)&GAMMA, REAL, NO, "1.4");
  init_var("NX", (char*)&NX, INT, NO, "300");
  init_var("NY", (char*)&NY, INT, NO, "200");
  init_var("NINTERM", (char*)&NINTERM, INT, NO, "20");
  init_var("NTOT", (char*)&NTOT, INT, NO, "1000");
  init_var("PLANETCONFIG", (char*)&PLANETCONFIG, STRING, NO, "planets/hr8799.cfg");
  init_var("SETUP", (char*)&SETUP, STRING, NO, "fargo		");
  init_var("SPACING", (char*)&SPACING, STRING, NO, "Log");
  init_var("FRAME", (char*)&FRAME, STRING, NO, "G");
  init_var("OUTPUTDIR", (char*)&OUTPUTDIR, STRING, NO, "outputs/hr8799_adi");
  init_var("INDIRECTTERM", (char*)&INDIRECTTERM, BOOL, NO, "1");
  init_var("EXCLUDEHILL", (char*)&EXCLUDEHILL, BOOL, NO, "0");
  init_var("LOG", (char*)&LOG, BOOL, NO, "1");
  init_var("ZMAX", (char*)&ZMAX, REAL, NO, "1.0");
  init_var("SEMIMAJORAXIS", (char*)&SEMIMAJORAXIS, REAL, NO, "0.0");
  init_var("ZMIN", (char*)&ZMIN, REAL, NO, "0.0");
  init_var("ETA", (char*)&ETA, REAL, NO, "0.0");
  init_var("NOISE", (char*)&NOISE, REAL, NO, "0.0");
  init_var("MASSTAPER", (char*)&MASSTAPER, REAL, NO, "0.0");
  init_var("PLANETMASS", (char*)&PLANETMASS, REAL, NO, "0.0");
  init_var("VMAX", (char*)&VMAX, REAL, NO, "1.0");
  init_var("INNERRESONANCE", (char*)&INNERRESONANCE, REAL, NO, "0.5");
  init_var("RELEASEDATE", (char*)&RELEASEDATE, REAL, NO, "0.0");
  init_var("VMIN", (char*)&VMIN, REAL, NO, "0.0");
  init_var("CS", (char*)&CS, REAL, NO, "1.0");
  init_var("OORTA", (char*)&OORTA, REAL, NO, "-0.75");
  init_var("INCLINATION", (char*)&INCLINATION, REAL, NO, "0.0");
  init_var("CFL", (char*)&CFL, REAL, NO, "0.44");
  init_var("ORBITALRADIUS", (char*)&ORBITALRADIUS, REAL, NO, "0.0");
  init_var("NU", (char*)&NU, REAL, NO, "0.0");
  init_var("RELEASERADIUS", (char*)&RELEASERADIUS, REAL, NO, "0.0");
  init_var("OUTERRESONANCE", (char*)&OUTERRESONANCE, REAL, NO, "1.5");
  init_var("VERTICALDAMPING", (char*)&VERTICALDAMPING, REAL, NO, "0.0");
  init_var("NZ", (char*)&NZ, INT, NO, "1");
  init_var("NSNAP", (char*)&NSNAP, INT, NO, "0");
  init_var("REALTYPE", (char*)&REALTYPE, STRING, NO, "Standard  #float or double");
  init_var("PLOTLINE", (char*)&PLOTLINE, STRING, NO, "field[:,:,0]");
  init_var("COORDINATES", (char*)&COORDINATES, STRING, NO, "standard");
  init_var("FIELD", (char*)&FIELD, STRING, NO, "gasdens");
  init_var("CMAP", (char*)&CMAP, STRING, NO, "cubehelix");
  init_var("FUNCARCHFILE", (char*)&FUNCARCHFILE, STRING, NO, "std/func_arch.cfg");
  init_var("ASPECT", (char*)&ASPECT, STRING, NO, "auto");
  init_var("PERIODICY", (char*)&PERIODICY, BOOL, NO, "0");
  init_var("PERIODICZ", (char*)&PERIODICZ, BOOL, NO, "0");
  init_var("AUTOCOLOR", (char*)&AUTOCOLOR, BOOL, NO, "1");
  init_var("WRITEVX", (char*)&WRITEVX, BOOL, NO, "0");
  init_var("WRITEVZ", (char*)&WRITEVZ, BOOL, NO, "0");
  init_var("WRITEDENSITY", (char*)&WRITEDENSITY, BOOL, NO, "0");
  init_var("WRITEBX", (char*)&WRITEBX, BOOL, NO, "0");
  init_var("PLANETHEATING", (char*)&PLANETHEATING, BOOL, NO, "0");
  init_var("VTK", (char*)&VTK, BOOL, NO, "0");
  init_var("WRITEENERGY", (char*)&WRITEENERGY, BOOL, NO, "0");
  init_var("WRITETAU", (char*)&WRITETAU, BOOL, NO, "0");
  init_var("COLORBAR", (char*)&COLORBAR, BOOL, NO, "1");
  init_var("WRITEBY", (char*)&WRITEBY, BOOL, NO, "0");
  init_var("WRITEENERGYRAD", (char*)&WRITEENERGYRAD, BOOL, NO, "0");
  init_var("DISK", (char*)&DISK, BOOL, NO, "0");
  init_var("WRITEBZ", (char*)&WRITEBZ, BOOL, NO, "0");
  init_var("WRITEDIVERGENCE", (char*)&WRITEDIVERGENCE, BOOL, NO, "0");
  init_var("WRITEVY", (char*)&WRITEVY, BOOL, NO, "0");
}
예제 #25
0
파일: jeu.c 프로젝트: ulricheza/Isima
int mode_local_client(SDL_Surface * fenetre)
{
   /*declaration des variables*/
   var_game_t * var;
   void * temp;
   long ready = 1;
   long deb;
   char * adresse_ip;
   pthread_t thread;
   SDL_Event event;

   /*ouverture du module socket sous windows*/
   #ifdef __WIN32__
      WSADATA WSAData;
      WSAStartup(MAKEWORD(2,2), &WSAData);
   #endif


   /*allocation des ressources*/
   init_var(0,&var);

   var->ecran = fenetre;
   SDL_BlitSurface(var->background,NULL,var->ecran,&(var->position_back));
   SDL_Flip(var->ecran);
   do
   {
      
      adresse_ip = read_adress(var);
      /*creation de la socket*/
      var->sock_client=socket(AF_INET, SOCK_STREAM, 0);

      /*configuration de la connexion*/
      var->sin_client.sin_addr.s_addr = inet_addr(adresse_ip);
      var->sin_client.sin_family = AF_INET;
      var->sin_client.sin_port = htons(PORT);
   }while(connect(var->sock_client, (SOCKADDR*) &var->sin_client, sizeof(var->sin_client)) < 0);
   
   SDL_BlitSurface(var->background,NULL,var->ecran,&(var->position_back));
   SDL_Flip(var->ecran);
   message_box(var,"connection effectue");

   
   pthread_create(&thread, NULL,(void *)recept_rdy,var);
   placement_hum(var);

   ready = htonl(1);
   if(send(var->sock_client,&ready,sizeof(long),0) == -1)
   {
      fprintf(var->log_erreur,"Erreur envoie ready\n");
      fclose(var->log_erreur);
      exit(EXIT_FAILURE);
   }

   message_box(var,"placement des bateaux du joueur adverse \n");
   while(pthread_join(thread,&temp) !=0)  
   {
      SDL_PollEvent(&event);
      if(event.type == SDL_QUIT)
         fin(var,1);
      SDL_Delay(20);
   }

   /*reception du jeton de depart*/
   if(recv(var->sock_client, &deb, sizeof(long),0) == -1)
   {
      fprintf(var->log_erreur,"Erreur reception deb\n");
      fclose(var->log_erreur);
      exit(EXIT_FAILURE);
   }
   deb = ntohl(deb);

   affich_score(var,0);
   affich_score(var,1);
   
   while(var->remain_bat_cpu != 0 && var->remain_bat_hum != 0)
   {

      if(deb == 1)
      {
         pthread_create(&thread, NULL,(void *)recept_coord,var);
         /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
         message_box(var,"tir du joueur adverse");
         while(pthread_join(thread,&temp) !=0)  
         {
            SDL_PollEvent(&event);
            if(event.type == SDL_QUIT)
               fin(var,1);
            SDL_Delay(20);
         }
      }

      message_box(var,"A vous de tirer !");
      var->z = tir_humain(var);
      envoi_coord(var);

      pthread_create(&thread, NULL,(void *)recept_rep,var);
      /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
      message_box(var,"reponse joueur adverse");
      while(pthread_join(thread,&temp) !=0)  
      {
         SDL_PollEvent(&event);
         if(event.type == SDL_QUIT)
            fin(var,1);
         SDL_Delay(20);
      }
      
      if(deb != 1)
      {
         pthread_create(&thread, NULL,(void *)recept_coord,var);
         /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
         message_box(var,"tir du joueur adverse \n");
         while(pthread_join(thread,&temp) !=0)  
         {
            SDL_PollEvent(&event);
            if(event.type == SDL_QUIT)
            fin(var,1);
            SDL_Delay(20);
         }
      }
   }
   if(var->remain_bat_cpu == 0)
   {
      message_box(var,"Bravo vous avez gagne(e)");
      FSOUND_PlaySound(FSOUND_FREE,var->gagne);
   }
   else
   {
      message_box(var,"Dommage vous avez perdu(e)");
      FSOUND_PlaySound(FSOUND_FREE,var->perdu);
   }
   
   SDL_Delay(3000);
   message_box(var,"le menu s'affichera dans 5s");
   SDL_Delay(5000);
   
   close_sock(var,0);
   fin(var,0);
   #ifdef __WIN32__
      WSACleanup();
   #endif

   return(EXIT_SUCCESS);
}
예제 #26
0
파일: jeu2p.c 프로젝트: ulricheza/Isima
int mode_local_serveur()
{
   /*declaration des variables*/
   var_game_t * var;
   void * temp;
   long ready = 1;
   long deb;
   pthread_t thread;


   /*ouverture du module socket sous windows*/
   #ifdef __WIN32__
      WSADATA WSAData;
      WSAStartup(MAKEWORD(2,2), &WSAData);
   #endif


   /*allocation des ressources*/
   init_var(0,&var);

   /*creation de la socket*/
   var->sock_serveur=socket(AF_INET, SOCK_STREAM, 0);

   /*configuration de la connexion*/
   var->sin_serveur.sin_addr.s_addr = htonl(INADDR_ANY);
   var->sin_serveur.sin_family = AF_INET;
   var->sin_serveur.sin_port = htons(PORT);

   if( bind(var->sock_serveur, (SOCKADDR*)&(var->sin_serveur), sizeof(var->sin_serveur)) < 0)
   {
      fprintf(var->log_erreur,"erreur lors du bind serveur \n");
      fclose(var->log_erreur);
      exit(EXIT_FAILURE);
   }

   if(listen(var->sock_serveur,5) == -1)
   {
      fprintf(var->log_erreur,"erreur lors du listen \n");
      fclose(var->log_erreur);
      exit(EXIT_FAILURE);
   }

   deb = rand()%2;


   pthread_create(&thread, NULL,(void *)accept_connect,var);
   /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
   printf("attente de connexion du joueur adverse\n");
   pthread_join(thread,&temp);

   pthread_create(&thread, NULL,(void *)recept_rdy,var);
   printf("-----------------------------------------------------\n");
   printf("placement de vos bateaux\n");
   placement_hum(var);

   ready = htonl(1);
   if(send(var->sock_client,&ready,sizeof(long),0) == -1)
   {
      fprintf(var->log_erreur,"Erreur envoie ready\n");
      fclose(var->log_erreur);
      exit(EXIT_FAILURE);
   }
   printf("attente placement des bateaux du joueur adverse \n");
   pthread_join(thread,&temp);

   deb = htonl(deb);
   if(send(var->sock_client,&deb,sizeof(long),0) == -1)
   {
       fprintf(var->log_erreur,"Erreur envoie deb\n");
       fclose(var->log_erreur);
       exit(EXIT_FAILURE);
   }
   deb = ntohl(deb);
   while(var->remain_bat_cpu != 0 && var->remain_bat_hum != 0)
   {
      clear
      printf("-----------------------------------------------------\n");
      printf("-----------------------------------------------------\n");
      printf("votre matrice cible \n");
      affic_mat(var->mer_cible_hum,0);
      printf("-----------------------------------------------------\n");
      printf("-----------------------------------------------------\n");
      printf("votre matrice home\n");
      affic_mat(var->mer_home_hum,1);
      printf("-----------------------------------------------------\n");
      printf("-----------------------------------------------------\n");

      if(deb == 1)
      {
         printf("A vous de tirer !\n");
         var->z = tir_humain(var);
         envoi_coord(var);

         pthread_create(&thread, NULL,(void *)recept_rep,var);
         /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
         printf("attente reponse joueur adverse\n");
         pthread_join(thread,&temp);

      }

      pthread_create(&thread, NULL,(void *)recept_coord,var);
      /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
      printf("attente du tir du joueur adverse \n");
      pthread_join(thread,&temp);

      if(deb != 1)
      {
         printf("A vous de tirer !\n");
         var->z = tir_humain(var);
         envoi_coord(var);

         pthread_create(&thread, NULL,(void *)recept_rep,var);
         /*gestion du rafraichissement SDL pas d'actualité dans cette version*/
         printf("attente reponse joueur adverse\n");
         pthread_join(thread,&temp);

      }
   }
   if(var->remain_bat_cpu == 0)
      printf("Bravo vous avez gagne!!!\n");
   else
      printf("dommage vous avez perdu \n");

   close_sock(var, 1);

   #ifdef __WIN32__
      WSACleanup();
   #endif

   free(var->mer_home_cpu);
   free(var->mer_home_hum);
   free(var->mer_cible_cpu);
   free(var->mer_cible_hum);
   fclose(var->log_erreur);
   free(var);
   return(1);
}
예제 #27
0
int main( int argc, char* argv[] )
{
  //Initialisieren
    ZWattribute=ZWgetattribute();
    load_options();
    ZWinitparameter();
    ZWattribute->strech=stretched;
    if (fullscreen)
    {
      ZWattribute->width=resolutionx;
      ZWattribute->height=resolutiony;
      ZWattribute->sdlflags|=SDL_FULLSCREEN;
    }
    else
    {
      ZWattribute->width=windowx;
      ZWattribute->height=windowy;
    }
    ZWattribute->quit_function=quit_function;
    ZWattribute->initflags|=SDL_INIT_AUDIO;
		
		load_mapping();
		
    ZWinitsdl();
    
    int audio_rate = 44100;
    Uint16 audio_format = AUDIO_S16SYS; 
    int audio_channels = 2;
    int audio_buffers = 2048;
    if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers))
    {
      printf("Unable to open audio!\n");
      exit(1);
   }
    
    if ((ZWattribute->sdlflags & SDL_FULLSCREEN)==0) //SDL_FULLSCREEN nicht mehr gesetzt? AAAAHHHH!
    {
      fullscreen=0;
      windowx=ZWattribute->width;
      windowy=ZWattribute->height;
      resolutionx=ZWattribute->resolution[0].x;
      resolutiony=ZWattribute->resolution[0].y;
    }
    ZWinitopengl();    
    setup_opengl();
    glHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST);
    init_var();
        
  //Level laden
    if (argc<2)
    {
      printf("Not enough arguments\n");
      printf("testboard file.opxml [player]\n");
      ZWquitfont();
      ZWquitsdl();      
      return 1;
    }
    if (loadlevel(argv[1])==1)
    {
      printf("File %s not found\n",argv[1]);
      ZWquitfont();
      ZWquitsdl();   
      return 1;
    }  
    refreshsetlist();

  //Minispielliste laden
	  load_minigames();
		save_minigames();

  /*//zu Debugzwecken Set 0 bis 60 ausgeben:
  for (int a=0;a<61;a++)
  {
    if (setbynr[a]==NULL)
      printf("Set %i: NULL\n",a);
    else
      printf("Set %i: \"%s\"\n",a,setbynr[a]->type);  
  }*/

  //Debug
    if (argc>3 && argv[3][0]=='c')
      all_are_cpu=1;

  //Spielvorbereitungen
    if (argc>2)
      playernum=atoi(argv[2]);
    playernum=(playernum-1)%8+1;

		
		if (argc>3 && argv[3][1]=='2')
		{
			playernum=((playernum+1)/2)*2;
			if (playernum<4)
			  playernum=4;
			teamsize=2;
		}
		if (argc>3 && argv[3][1]=='3')
		{
			playernum=6;
			teamsize=3;
		}
		if (argc>3 && argv[3][1]=='4')
		{
			playernum=8;
			teamsize=4;
		}		

    pset startset=getsetbyname((char*)"start");
    if (startset==NULL) startset=firstset;
		prepare_game(startset,1);
		
    
  ZWreset_virtuell_joytick();
  //Controller festlegen:
  for (int a=0;a<playernum;a++)
  {
		if (all_are_cpu)
		  maindata.player[a].joystick_nr=-1;
		else		  
		  maindata.player[a].joystick_nr=a%ZWattribute->realjoystickcount;
  }
	calib_all_controllers();
  //Spiel starten
    Mix_FadeInMusic(backgroundmusic, -1,FADE_IN_TIME);
    ZWattribute->newticks=SDL_GetTicks();
    ZWschleifeex((void(*)(void*))draw_main,(int(*)(void*))calc_main_thread,(int(*)(void*))calc_main,
                 (void*)(&maindata),sizeof(tmaindata));    
    Mix_HaltMusic();
  //alles wieder freigeben
    reset_after_game();
    del_objects();
    del_sounds();
    Mix_CloseAudio();
    ZWquitfont();
    ZWquitsdl();
  return 0;
}
예제 #28
0
파일: jeu1p.c 프로젝트: ulricheza/Isima
int main(int argc, char * argv[])
{

   int rep_tir_cpu;
   int z,i,x,y;
   int * permit_tir;
   var_game_t * var;

   init_var(1,&var);

   permit_tir = (int *)malloc(100*sizeof(int));
   if(permit_tir == NULL)
   {
      fprintf(var->log_erreur,"erreur dans l'allocation de permit_tir\n");
      exit_err(var);
   }
   for(i=0;i<100;i++)
      permit_tir[i] = i;

   clear
   printf("-----------------------------------------------------\n");
   printf("Bienvenue sur la version 0.1 de Navy Battle \n");
   printf("Cette version sert de test pour le moteur du jeu\n");
   printf("attention les cases vont de 0 a 9               \n");
   printf("-----------------------------------------------------\n");
   printf("-----------------------------------------------------\n");
   printf("placement des bateaux CPU\n");
   placement_alea(var);
   printf("-----------------------------------------------------\n");
   printf("placement de vos bateaux\n");
   placement_hum(var);
   printf("-----------------------------------------------------\n");
   printf("DEBUT DU JEU\n");
   clear
   while(var->remain_bat_cpu != 0 && var->remain_bat_hum != 0)
   {
      printf("-----------------------------------------------------\n");
      printf("-----------------------------------------------------\n");
      printf("votre matrice cible \n");
      affic_mat(var->mer_cible_hum,0);
      printf("-----------------------------------------------------\n");
      printf("-----------------------------------------------------\n");
      printf("votre matrice home\n");
      affic_mat(var->mer_home_hum,1);
      printf("-----------------------------------------------------\n");
      printf("-----------------------------------------------------\n");
      printf("A vous de tirer !\n");
      z = tir_humain(var);
      clear
      var->mer_cible_hum[z] = reponse_tir(z,1,var);
      switch(var->mer_cible_hum[z])
      {
         case 0: printf("Votre tir a rate\n");
                 break;
         case 1: printf("Votre tir a touche un bateau\n");
                 break;
         case 2: printf("Votre tir a touche et coule un bateau\n");
                 var->remain_bat_cpu = var->remain_bat_cpu - 1;
                 break;
      }
      printf("Au CPU de tirer\n");
      z = tir_alea(permit_tir, &rep_tir_cpu, var);
      trans1D_2D(z,&x,&y);
      printf("le CPU a tire a la case %d %d \n",x,y);
      switch(rep_tir_cpu)
      {
         case 0: printf("Son tir a rate\n");
                 break;
         case 1: printf("Son tir a touche un de vos bateau\n");
                 break;
         case 2: printf("Son tir a touche et coule un de vos bateau\n");
                 break;
      }
   }
   if(var->remain_bat_cpu == 0)
      printf("Bravo vous avez gagne!!!\n");
   else
      printf("dommage vous avez perdu \n");

   free(var->mer_home_cpu);
   free(var->mer_home_hum);
   free(var->mer_cible_cpu);
   free(var->mer_cible_hum);
   free(permit_tir);
   fclose(var->log_erreur);
   free(var);
   return(EXIT_SUCCESS);
}
예제 #29
0
파일: main.c 프로젝트: Biotron/kpgweigher
void main(void)
{                            
   
    u16 i;                                      
    u8 shortcut = KEY_INVALID;  
    // RS485 Node    
    init_var();	//init data structure 
    // System Initialization
    Init_Port();
//    Init_Timers();
//    Init_Ex_Interrupt();
    Init_UART();  
    Enable_XMEM();
    Init_554();                
    InitLED();    
    Key_Init();    
    // Global enable interrupts
    WDTCR = 0x00; //disable dog watch
    #asm("sei")                 
    /*********************************************************************/
    // System hardware dection
    /*********************************************************************/
    // intialize LED. 
    nextwin = 0; 
    
    sleepms(20*ONEMS);
    LCD_Init();
    wnd_msgbox(&bootup);
    //init the DMM
    nav_command(NAV_INIT);              
    sleepms(200*ONEMS);                                
    navto1v();
    nav_command(NAV_SLOWMODE);
    sleepms(200*ONEMS);
    nav_command(NAV_AFLTON);
    sleepms(200*ONEMS);
                     
    sleepms(2*ONEMS); //wait until all the node is ready after power up        
    State_Init();	
    
    SET_BORE_MODE;
    
	 nextwin = PG_BOOTTYPE;
	 key = KEY_INVALID;

	 curr_ch = 1; //channel for display
	 curr_dispch = 1;
	 while(1)
	 {
 	 	if(nextwin != 0)
		{
			SwitchWindow(nextwin);
			(*curr_window)(MSG_INIT);
			nextwin = 0;
		}
		if(key != KEY_INVALID)
		{
			if((key == KEY_BTN1)||(key == KEY_BTN2)||(key == KEY_BTN3)||(key == KEY_BTN4))
			{                      
			        shortcut = key;          
                                //processing shortcut key
				if(curr_window == pgmain_handler)
				{
					LCD_Cls();
					wnd_msgbox(&modify);
				}
				if(shortcut == KEY_BTN1) //mode switch
				{
               			        SET_TOP1MA;
	                	        SET_TOPT1000;                				
					if(IS_BORE_MODE){
						SET_THERM_MODE;
					}else{
						SET_BORE_MODE;
					}
					dlg_cnt = 0;					
					onesec_cnt = 0;
					phase = 0;      //reset the state machine
				}
				if(shortcut == KEY_BTN2) //auto ktt or not
				{
					if(IS_BORE_MODE)
					{
                      			        SET_TOP1MA;
	                        	        SET_TOPT1000;                				
						if((IS_MODE_KTT)){
							CLR_MODE_KTT;
							SET_PKTT;
						}else{
							SET_MODE_KTT;
							SET_PKTT;
						}
        					dlg_cnt = 0;					
	        				onesec_cnt = 0;
		        			phase = 0;      //reset the state machine
					}
				}
				if(shortcut == KEY_BTN3) //thermal probe type
				{                            
					display_buttons(KEY_BTN3,1);
					if(IS_THERM_MODE)
					{                        
					        i = sysdata.tid[curr_dispch-1];
					        if(i != INVALID_PROBE)
					        {
                					if((tprbdata.type[i] >= PRBTYPE_K) &&\
	                				   (tprbdata.type[i] <= PRBTYPE_R))
		                			{
			                			if(tprbdata.type[i] == PRBTYPE_R)
				                			tprbdata.type[i] = PRBTYPE_K;
					                	else
						                	tprbdata.type[i] +=1;
        					        }                                                                                 
        					        if(rundata.reading[curr_dispch-1] > -9000)
                                                       		rundata.temperature[curr_dispch-1] = MValueToTValue(rundata.reading[curr_dispch-1], tprbdata.type[i]);
        					}
                                        }
					display_buttons(KEY_BTN3,0);
					
				}
				if(shortcut == KEY_BTN4) //remove zero
				{
					display_buttons(KEY_BTN4,1);
					if(IS_BORE_MODE){
					        sysdata.R0 = rundata.Rx;
					}else{             
					        //sysdata.V0 = nav_read();
					        nav_command(NAV_ZEROON);
					        sleepms(1000*ONEMS);
					}
					display_buttons(KEY_BTN4,0);
				}
				if(curr_window == pgmain_handler)       //redraw the running window
				{
					pgmain_handler(MSG_INIT);      
				}
			        shortcut = KEY_INVALID;
			        			        
			}else{
				(*curr_window)(key);
			}
			key = KEY_INVALID;
	  	}else{
			if(curr_window != pgmain_handler)
				continue;                               
			if(dlg_cnt > 1)
			{         
			        onesec_cnt++;
			        if(onesec_cnt == (ONESEC-10))
			        {       
        			        updatestate();
        			}
        			if(onesec_cnt == ONESEC)
        			        onesec_cnt = 0 ;
				dlg_cnt--;
				continue;
			}    
			updatestate();
			if((IS_THERM_MODE))			
			{
				if(therm_state() == 0)
				        continue;
			}else{
				if(bore_state() == 0)
				        continue;
			}     
			
                        //shift to next channel 
                       
                        while(true)
                        {
                                ch_to_search += 1;
        			if(ch_to_search >= MAX_CH_NUM)
        			{
	        			ch_to_search = 0;
	        			break;
	        		}           
	        		if(IS_THERM_MODE)
	        		{
	        		        i = sysdata.tid[ch_to_search];
	        		}else{
	        		        i = sysdata.rid[ch_to_search];
	        		}
	        		if(i == INVALID_PROBE)
	        		        continue;
	        		if(IS_THERM_MODE)
	        		{   
       					if((tprbdata.type[i] >= PRBTYPE_K) && (tprbdata.type[i] <= PRBTYPE_R))
       					        break;
	        		}else{
       		                        if((rprbdata.type[i] <= PRBTYPE_MAX) && (rprbdata.type[i] >= PRBTYPE_MIN))
       		        		        break;
	        		}
	                }
		}
	}	
}      
예제 #30
0
파일: jeu.c 프로젝트: ulricheza/Isima
int mode_solo(SDL_Surface * fenetre)
{
   int rep_tir_cpu;
   int i,x,y;
   int * permit_tir;
   var_game_t * var;

   init_var(1,&var);
   var->ecran = fenetre;
   SDL_BlitSurface(var->background,NULL,var->ecran,&(var->position_back));
   SDL_Flip(var->ecran);
   permit_tir = (int *)malloc(100*sizeof(int));
   if(permit_tir == NULL)
   {
      fprintf(var->log_erreur,"erreur dans l'allocation de permit_tir\n");
      exit_err(var);
   }
   for(i=0;i<100;i++)
      permit_tir[i] = i;
   
   placement_alea(var);

   message_box(var,"placement de vos bateau");
   placement_hum(var);

   affich_score(var,0);
   affich_score(var,1);
   
   while(var->remain_bat_cpu != 0 && var->remain_bat_hum != 0)
   {
      message_box(var,"A vous de tirer");
      var->z = tir_humain(var);
      var->mer_cible_hum[var->z] = reponse_tir(var->z,1,var);
      if(var->mer_cible_hum[var->z] == 2)
      {
         (var->remain_bat_cpu)--;
	 affich_score(var,1);
      }
      SDL_Delay(2500);
      if(var->remain_bat_hum != 0)
      {
         message_box(var,"Au CPU de tirer");
         var->z = tir_alea(permit_tir, &rep_tir_cpu, var);
         if(rep_tir_cpu == 2)
            affich_score(var,0);
      }
      SDL_Delay(2500);
   }
   if(var->remain_bat_cpu == 0)
   {
      message_box(var,"Bravo vous avez gagne(e)");
      FSOUND_PlaySound(FSOUND_FREE,var->gagne);
   }
   else
   {
      message_box(var,"Dommage vous avez perdu(e)");
      FSOUND_PlaySound(FSOUND_FREE,var->perdu);
   }
   
   SDL_Delay(3000);
   message_box(var,"le menu s'affichera dans 5s");
   SDL_Delay(5000);
   fin(var,0);
   return(EXIT_SUCCESS);
}