Logo Search packages:      
Sourcecode: teg version File versions  Download package

TEG_STATUS fichas_out (  ) 

Envia las fichas al server. Usada por FICHAS, FICHAS2 y FICHASC

Definition at line 218 of file fichas.c.

References fichas_check(), PLAYER_STATUS_FICHAS, PLAYER_STATUS_FICHAS2, PLAYER_STATUS_FICHASC, PLAYER_STATUS_POSTFICHAS, PLAYER_STATUS_POSTFICHAS2, and PLAYER_STATUS_POSTFICHASC.

Referenced by ai_fichasc().

{
      char buf[2000];
      char tmp[100];
      int *ptr;
      int i;
      int first_time;
      PLAYER_STATUS e;

      if( fichas_check() != TEG_STATUS_SUCCESS ) {
            textmsg( M_ERR,_("Error, its not the time to send armies"));
            return TEG_STATUS_ERROR;
      }

      if( fichas_finish( &ptr ) != TEG_STATUS_SUCCESS )  {
            fichas_reset();
            textmsg( M_ERR,_("Error, put the correct number of armies"));
            return TEG_STATUS_ERROR;
      }

      buf[0]=0;
      tmp[0]=0;

      first_time = 1;

      for(i=0;i<COUNTRIES_CANT;i++) {
            if( ptr[i]>0 ) {
                  if( first_time )
                        sprintf(tmp,"%d:%d",i,ptr[i]);
                  else
                        sprintf(tmp,",%d:%d",i,ptr[i]);
                  strcat(buf,tmp);
                  first_time = 0;
            }
      }

      e = ESTADO_GET();
      switch(e) {
      case PLAYER_STATUS_FICHAS:
            net_printf(g_game.fd,TOKEN_FICHAS"=%s\n",buf);
            ESTADO_SET( PLAYER_STATUS_POSTFICHAS);
            break;
      case PLAYER_STATUS_FICHAS2:
            net_printf(g_game.fd,TOKEN_FICHAS2"=%s\n",buf);
            ESTADO_SET( PLAYER_STATUS_POSTFICHAS2);
            break;
      case PLAYER_STATUS_FICHASC:
            net_printf(g_game.fd,TOKEN_FICHASC"=%s\n",buf);
            ESTADO_SET( PLAYER_STATUS_POSTFICHASC);
            break;
      default:
            textmsg( M_ERR,_("Error, its not the moment to send your armies"));
            return TEG_STATUS_ERROR;
      }
      return TEG_STATUS_SUCCESS;
}


Generated by  Doxygen 1.6.0   Back to index