/* Parses the armies the player must place the rest of the times */ STATIC TEG_STATUS token_fichasc( int fd, char *str ) { PSPLAYER pJ; int total_armies; PLAY_DEBUG("token_fichasc()\n"); if( player_whoisfd( fd, &pJ ) != TEG_STATUS_SUCCESS ) goto error; if( pJ->estado != PLAYER_STATUS_FICHASC && pJ->estado != PLAYER_STATUS_CANJE ) goto error; total_armies = pJ->fichasc_armies + cont_tot(pJ->fichasc_conts); if( pJ->hizo_canje ) total_armies += cuantos_x_canje( pJ->tot_exchanges ); if( aux_token_fichas( fd, str, total_armies, pJ->fichasc_conts) == TEG_STATUS_SUCCESS ) { pJ->estado = PLAYER_STATUS_IDLE; fichasc_next(); pJ->hizo_canje = FALSE; pJ->fichasc_armies = 0; pJ->fichasc_conts = 0; return TEG_STATUS_SUCCESS; } error: net_print(fd,TOKEN_ERROR"="TOKEN_FICHASC"\n"); return TEG_STATUS_PARSEERROR; }
/* someone is placing the continents armies */ TEG_STATUS clitok_fichasc( char *str) { int numjug; int cant,tot_cant; unsigned long conts; PCPLAYER j; PARSER p; DELIM igualador={ ':', ':', ':' }; DELIM separador={ ',', ',', ',' }; p.igualador = &igualador; p.separador = &separador; p.data = str; if( strlen(str)==0 ) goto error; if( parser_call( &p ) && p.hay_otro ) { numjug = atoi( p.token ); } else goto error; if( parser_call( &p ) && p.hay_otro ) { conts = atoi( p.token ); } else goto error; if( parser_call( &p ) && !p.hay_otro ) { cant = atoi( p.token ); } else goto error; if( player_whois( numjug, &j) != TEG_STATUS_SUCCESS) goto error; attack_unshow(); g_game.whos_turn = numjug; gui_sensi(); tot_cant = cont_tot( conts ) + cant; out_countries(); if( numjug == g_game.numjug ) { ESTADO_SET(PLAYER_STATUS_FICHASC); fichas_init( tot_cant, conts ); gui_fichas(cant,conts); } else { textmsg(M_INF,_("Player %s(%s) is placing %d armies"), j->name, _(g_colores[j->color]), cant); } return TEG_STATUS_SUCCESS; error: textmsg(M_ERR,"Error in clitok_fichasc()"); return TEG_STATUS_ERROR; }
TEG_STATUS fichas_get_wanted( int *cant, int *conts ) { *cant = wanted_tot - cont_tot(wanted_conts); *conts = wanted_conts; return TEG_STATUS_SUCCESS; }