Example #1
0
File: ejer2.c Project: NatTuck/teg
TEG_STATUS ejer2_restore_from_error()
{
	if( last_country != -1) {
		tarjeta_desusar( &g_countries[ last_country ].tarjeta );
		gui_tarjeta( -1 );
		last_country = -1;
		return TEG_STATUS_SUCCESS;
	}
	return TEG_STATUS_ERROR;
}
Example #2
0
/* I'm receiving the card I've requested after finishing my turn */
TEG_STATUS clitok_tarjeta(char *str)
{
	PARSER p;
	DELIM igualador={ ':', ':', ':' };
	DELIM separador={ ',', ',', ',' };
	int country,used;

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

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


	if( parser_call( &p ) && p.hay_otro ) {
		country = atoi( p.token );
	} else goto error;

	if( parser_call( &p ) && !p.hay_otro ) {
		used = atoi( p.token );		
	} else goto error;

	if( country < 0 || country >= COUNTRIES_CANT )
		goto error;

	ESTADO_SET(PLAYER_STATUS_TARJETA);

	InsertTailList( &g_game.tarjetas_list, (PLIST_ENTRY) &g_countries[ country ].tarjeta );
	g_game.tarjetas_cant++;

	if( used )
		tarjeta_usar( &g_countries[ country ].tarjeta );
	g_countries[ country ].tarjeta.numjug = WHOAMI();

	if( used ) {
		textmsg(M_IMP,_("You received card: '%s' and 2 armies where placed there"), countries_get_name( country ) );
	} else {
		textmsg(M_IMP,_("You received card: '%s'"), countries_get_name( country ) );
	}

	gui_tarjeta( country );
	return TEG_STATUS_SUCCESS;

error:
	textmsg(M_ERR,"Error in clitok_tarjeta()");
	return TEG_STATUS_ERROR;
}