Ejemplo n.º 1
0
/* receives the players scores */
TEG_STATUS clitok_scores( char *str)
{
	PSCORES pS;
	SCORES score;
	PARSER p;
	DELIM igualador = DELIM_NULL;
	DELIM separador={ '\\', '\\', '\\' };

	int i;

	if( strlen(str)==0 )
		goto ok;

	p.igualador = &igualador;
	p.separador = &separador;
	p.data = str;

	scores_flush();

	do {
		if( (i=parser_call( &p )) ) {
			if( aux_scores( &score, p.token ) != TEG_STATUS_SUCCESS )
				goto error;

			pS = malloc( sizeof(*pS));
			if( ! pS )
				goto error;

			*pS = score;
			scores_insert_score( pS );
		}
	} while( i && p.hay_otro);

ok:
	gui_scores();
	return TEG_STATUS_SUCCESS;
error:
	textmsg(M_ERR,"Error in clitok_scores()");
	return TEG_STATUS_PARSEERROR;
}
Ejemplo n.º 2
0
void gui_score_board(int pd, unsigned int types, int e, int h)
{
    int id, jd;//, kd;

    assert((types & GUI_SCORE_COIN) ||
           (types & GUI_SCORE_TIME) ||
           (types & GUI_SCORE_GOAL) );

    /* Make sure current score type matches the spec. */

    while (!(types & score_type))
        score_type = GUI_SCORE_NEXT(score_type);

    if ((id = video.device_w < video.device_h ? gui_vstack(pd) : gui_hstack(pd)))
    {
        gui_filler(id);

        if (video.device_w < video.device_h) {
            gui_scores(id, e);
            gui_space(id);
            gui_filler(id);
        }

        if ((jd = gui_vstack(id)))
        {
            gui_filler(jd);

            if (types & GUI_SCORE_COIN)
            {
                coin_btn_id = gui_state(jd, _("Most Coins"), GUI_MED,
                                        GUI_SCORE, GUI_SCORE_COIN);

                gui_set_hilite(coin_btn_id, score_type == GUI_SCORE_COIN);
            }
            if (types & GUI_SCORE_TIME)
            {
                time_btn_id = gui_state(jd, _("Best Times"), GUI_MED,
                                        GUI_SCORE, GUI_SCORE_TIME);

                gui_set_hilite(time_btn_id, score_type == GUI_SCORE_TIME);
            }
            if (types & GUI_SCORE_GOAL)
            {
                goal_btn_id = gui_state(jd, _("Fast Unlock"), GUI_MED,
                                        GUI_SCORE, GUI_SCORE_GOAL);

                gui_set_hilite(goal_btn_id, score_type == GUI_SCORE_GOAL);
            }

            if (h || (types & GUI_SCORE_SAVE)) gui_space(jd);

            if (h)
            {
                gui_state(jd, _("Change Name"), GUI_MED, GUI_NAME, 0);
            }
            if ((types & GUI_SCORE_SAVE))
            {
                gui_state(jd, _("Save Replay"), GUI_MED, GUI_SAVE, 0);
            }

            gui_filler(jd);
        }

        if (video.device_w >= video.device_h) {
            gui_space(id);
            gui_filler(id);
            gui_scores(id, e);
        }

        gui_filler(id);
    }
}