示例#1
0
void			check_fds_states(t_serv *serv, int type)
{
  char			*cmd;
  t_client		*tmp;

  tmp = (type == 0) ? serv->client : serv->gfx;
  while (tmp != NULL)
    {
      if (FD_ISSET(tmp->fd, &(serv->readfds)))
	{
	  if ((cmd = tmp->fct_read(serv, tmp->fd)) == NULL)
	    return;
	  if (tmp->connected == 1)
	    fill_cmd(cmd, tmp, serv);
	  else
	    check_team(serv, tmp, cmd);
	}
      if (tmp->cmd != NULL && tmp->need_write == 1)
      	if (FD_ISSET(tmp->fd, &(serv->writefds)))
      	  {
      	    tmp->fct_write(serv, tmp, tmp->shortest_cmd);
	    update_client(tmp, serv);
      	  }
      tmp = tmp->next;
   }
}
示例#2
0
文件: MiddleWare.c 项目: rplnt/abrt
static char *do_log_and_save_line(char *log_line, void *param)
{
    struct logging_state *l_state = (struct logging_state *)param;

    VERB1 log("%s", log_line);
    update_client("%s", log_line);
    free(l_state->last_line);
    l_state->last_line = log_line;
    return NULL;
}
示例#3
0
void run_game(void)
{
    //clmap = map_load_aos(fnmap);

    tcam.mpx = 256.5f;
    tcam.mpz = 256.5f;
    tcam.mpy = 32.0f-3.0f;
    //clmap->pillars[((int)tcam.mpz)*clmap->xlen+((int)tcam.mpy)][4+1]-2.0f;

    tcam.mxx = 1.0f;
    tcam.mxy = 0.0f;
    tcam.mxz = 0.0f;
    tcam.myx = 0.0f;
    tcam.myy = 1.0f;
    tcam.myz = 0.0f;
    tcam.mzx = 0.0f;
    tcam.mzy = 0.0f;
    tcam.mzz = 1.0f;

    int i;

    //render_vxl_redraw(&tcam, clmap);

    int quitflag = 0;

    usec_basetime = platform_get_time_usec();

    while(!quitflag)
    {
        // update time
        sec_lasttime = sec_curtime;
        int64_t usec_curtime = platform_get_time_usec() - usec_basetime;
        sec_curtime = ((float)usec_curtime)/1000000.0f;

        // update client/server
        if(boot_mode & 1)
            quitflag = quitflag || update_client();
        net_flush();
        if(boot_mode & 2)
            quitflag = quitflag || update_server();
        net_flush();
    }
    map_free(clmap);
    clmap = NULL;
}