Difference for socket/request.c from version 1.66 to 1.67


version 1.66 version 1.67
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_init_c =   * static char *rcsid_init_c =
  *    "$Id: request.c,v 1.66 2005/03/06 20:38:56 akirschbaum Exp $";   *    "$Id: request.c,v 1.67 2005/03/19 09:14:57 mwedel Exp $";
  */   */
   
 /*  /*
Line 306
 
Line 306
 }  }
   
  /**   /**
   * Tells client the picture it has to use    * A lot like the old AskSmooth (in fact, now called by AskSmooth).
   * to smooth a picture number given as argument.   * Basically, it makes no sense to wait for the client to request a
   * Also take care of sending those pictures to the client.   * a piece of data from us that we know the client wants.  So
   * For information, here is where we get the smoothing inforations:   * if we know the client wants it, might as well push it to the
   * - Take the facename and add '_smoothed' to it.   * client.
   * - Look for that archetype and find it's animation.  
   * - Use the animation elements from 0 to 8 for smoothing.  
   */    */
 void AskSmooth (char *buf, int len, NewSocket *ns){  void SendSmooth(NewSocket *ns, uint16 face) {
      char* defaultsmooth="default_smoothed.111";       uint16 smoothface;
      uint8 reply[MAX_BUF];       uint8 reply[MAX_BUF];
      SockList sl;       SockList sl;
      uint16 smoothface;  
      uint16 facenbr;  
   
      facenbr=atoi (buf);      /* If we can't find a face, return and set it so we won't try to send this
      if ((!FindSmooth (facenbr, &smoothface)) &&       * again.
          (!FindSmooth ( ( uint16 )FindFace(defaultsmooth,0), &smoothface))       */
         )      if ((!FindSmooth (face, &smoothface)) &&
            (!FindSmooth ( smooth_face->number, &smoothface))) {
   
           LOG(llevError,"could not findsmooth for %d. Neither default (%s)\n",face,smooth_face->name);
    ns->faces_sent[face] |= NS_FACESENT_SMOOTH;
    return;
       }
   
          LOG(llevError,"could not findsmooth for %d. Neither default (%s)\n",facenbr,defaultsmooth);      if (!(ns->faces_sent[smoothface] & NS_FACESENT_FACE))
      if (ns->faces_sent[smoothface] == 0)  
                 esrv_send_face(ns, smoothface, 0);                  esrv_send_face(ns, smoothface, 0);
   
       ns->faces_sent[face] |= NS_FACESENT_SMOOTH;
   
      sl.buf=reply;       sl.buf=reply;
      strcpy((char*)sl.buf,"smooth ");       strcpy((char*)sl.buf,"smooth ");
      sl.len=strlen((char*)sl.buf);       sl.len=strlen((char*)sl.buf);
      SockList_AddShort(&sl, facenbr);      SockList_AddShort(&sl, face);
      SockList_AddShort(&sl, smoothface);       SockList_AddShort(&sl, smoothface);
      Send_With_Handling(ns, &sl);       Send_With_Handling(ns, &sl);
 }  }
   
 /**  /**
     * Tells client the picture it has to use
     * to smooth a picture number given as argument.
     */
   void AskSmooth (char *buf, int len, NewSocket *ns){
       uint16 facenbr;
   
       facenbr=atoi (buf);
       SendSmooth(ns, facenbr);
   }
   
   
   
   
   
   /**
  * This handles the general commands from the client (ie, north, fire, cast,   * This handles the general commands from the client (ie, north, fire, cast,
  * etc.)   * etc.)
  */   */
Line 828
 
Line 847
      * the face itself) down to the client.       * the face itself) down to the client.
      */       */
     for (i=0; i<animations[anim_num].num_animations; i++) {      for (i=0; i<animations[anim_num].num_animations; i++) {
  if (ns->faces_sent[animations[anim_num].faces[i]] == 0)   if (!(ns->faces_sent[animations[anim_num].faces[i]] & NS_FACESENT_FACE))
      esrv_send_face(ns,animations[anim_num].faces[i],0);       esrv_send_face(ns,animations[anim_num].faces[i],0);
  SockList_AddShort(&sl, animations[anim_num].faces[i]);  /* flags - not used right now */   SockList_AddShort(&sl, animations[anim_num].faces[i]);  /* flags - not used right now */
     }      }
Line 867
 
Line 886
     }      }
     newmap->cells[x][y].faces[newmap->cells[x][y].count] = face_num;      newmap->cells[x][y].faces[newmap->cells[x][y].count] = face_num;
     newmap->cells[x][y].count ++;      newmap->cells[x][y].count ++;
     if (ns->faces_sent[face_num] == 0)      if (!(ns->faces_sent[face_num] & NS_FACESENT_FACE))
  esrv_send_face(ns,face_num,0);   esrv_send_face(ns,face_num,0);
 }  }
   
Line 1053
 
Line 1072
   
     if (face_num != ns->lastmap.cells[ax][ay].faces[layer]) {      if (face_num != ns->lastmap.cells[ax][ay].faces[layer]) {
  SockList_AddShort(sl, face_num);   SockList_AddShort(sl, face_num);
  if (face_num && ns->faces_sent[face_num] == 0)   if (!(face_num && ns->faces_sent[face_num] & NS_FACESENT_FACE))
      esrv_send_face(ns, face_num, 0);       esrv_send_face(ns, face_num, 0);
  heads[(ay * MAX_HEAD_POS + ax) * MAX_LAYERS + layer] = NULL;   heads[(ay * MAX_HEAD_POS + ax) * MAX_LAYERS + layer] = NULL;
  ns->lastmap.cells[ax][ay].faces[layer] = face_num;   ns->lastmap.cells[ax][ay].faces[layer] = face_num;
Line 1262
 
Line 1281
      */       */
     if (ns->lastmap.cells[sx][sy].faces[layer] != face_num)  {      if (ns->lastmap.cells[sx][sy].faces[layer] != face_num)  {
  ns->lastmap.cells[sx][sy].faces[layer] = face_num;   ns->lastmap.cells[sx][sy].faces[layer] = face_num;
  if (ns->faces_sent[face_num] == 0)   if (!(ns->faces_sent[face_num] & NS_FACESENT_FACE))
      esrv_send_face(ns, face_num, 0);       esrv_send_face(ns, face_num, 0);
  SockList_AddShort(sl, face_num);   SockList_AddShort(sl, face_num);
  return 1;   return 1;
Line 1301
 
Line 1320
     ob=NULL;      ob=NULL;
     head = heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer];      head = heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer];
   
   
     ob = GET_MAP_FACE_OBJ(mp, mx, my, layer);      ob = GET_MAP_FACE_OBJ(mp, mx, my, layer);
   
     /* If there is no object for this space, or if the face for the object      /* If there is no object for this space, or if the face for the object
Line 1310
 
Line 1328
     if (!ob || ob->face == blank_face || MAP_NOSMOOTH(mp)) smoothlevel=0;      if (!ob || ob->face == blank_face || MAP_NOSMOOTH(mp)) smoothlevel=0;
     else {      else {
      smoothlevel = ob->smoothlevel;       smoothlevel = ob->smoothlevel;
    if (smoothlevel && !(ns->faces_sent[ob->face->number] & NS_FACESENT_SMOOTH))
        SendSmooth(ns, ob->face->number);
     } /* else not already head object or blank face */      } /* else not already head object or blank face */
   
     /* We've gotten what face we want to use for the object.  Now see if      /* We've gotten what face we want to use for the object.  Now see if
Line 1327
 
Line 1347
     /* Nothing changed */      /* Nothing changed */
     return 0;      return 0;
 }  }
   
 /**  /**
  * Returns the size of a data for a map square as returned by   * Returns the size of a data for a map square as returned by
  * mapextended. There are CLIENTMAPX*CLIENTMAPY*LAYERS entries   * mapextended. There are CLIENTMAPX*CLIENTMAPY*LAYERS entries
Line 1601
 
Line 1622
      if (pl->contr->socket.lastmap.cells[ax][ay].faces[0] != pl->face->number) {       if (pl->contr->socket.lastmap.cells[ax][ay].faces[0] != pl->face->number) {
  pl->contr->socket.lastmap.cells[ax][ay].faces[0] = pl->face->number;   pl->contr->socket.lastmap.cells[ax][ay].faces[0] = pl->face->number;
  mask |= 0x1;   mask |= 0x1;
  if (pl->contr->socket.faces_sent[pl->face->number] == 0)   if (!(pl->contr->socket.faces_sent[pl->face->number] &NS_FACESENT_FACE))
      esrv_send_face(&pl->contr->socket, pl->face->number, 0);       esrv_send_face(&pl->contr->socket, pl->face->number, 0);
  SockList_AddShort(&sl, pl->face->number);   SockList_AddShort(&sl, pl->face->number);
      }       }


Legend:
line(s) removed in v.1.66 
line(s) changed
 line(s) added in v.1.67

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:37