Difference for server/c_object.c from version 1.76 to 1.77


version 1.76 version 1.77
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_c_object_c =   * static char *rcsid_c_object_c =
  *   "$Id: c_object.c,v 1.76 2006/01/11 16:28:00 cavesomething Exp $";   *   "$Id: c_object.c,v 1.77 2006/02/07 07:54:46 mwedel Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 812
 
Line 812
  *  This function was part of drop, now is own function.    *  This function was part of drop, now is own function.
  *  Player 'op' tries to put object 'tmp' into sack 'sack',    *  Player 'op' tries to put object 'tmp' into sack 'sack',
  *  if nrof is non zero, then nrof objects is tried to put into sack.    *  if nrof is non zero, then nrof objects is tried to put into sack.
    * Note that the 'sack' in question can now be a transport,
    * so this function isn't named very good anymore.
  */   */
 void put_object_in_sack (object *op, object *sack, object *tmp, uint32 nrof)   void put_object_in_sack (object *op, object *sack, object *tmp, uint32 nrof)
 {  {
Line 820
 
Line 822
     char buf[MAX_BUF];      char buf[MAX_BUF];
   
     if (sack==tmp) return; /* Can't put an object in itself */      if (sack==tmp) return; /* Can't put an object in itself */
     if (sack->type != CONTAINER) {      if (sack->type != CONTAINER && sack->type != TRANSPORT) {
       new_draw_info_format(NDI_UNIQUE, 0,op,        new_draw_info_format(NDI_UNIQUE, 0,op,
  "The %s is not a container.", query_name(sack));   "The %s is not a container.", query_name(sack));
       return;        return;
     }      }
     if (QUERY_FLAG(tmp,FLAG_STARTEQUIP)) {      if (QUERY_FLAG(tmp,FLAG_STARTEQUIP)) {
       new_draw_info_format(NDI_UNIQUE, 0,op,        new_draw_info_format(NDI_UNIQUE, 0,op,
  "You cannot put the %s in the container.", query_name(tmp));        "You cannot put the %s in the %s.", query_name(tmp),
       query_name(sack));
       return;        return;
     }      }
     if (tmp->type == CONTAINER && tmp->inv) {      if (tmp->type == CONTAINER && tmp->inv) {
Line 838
 
Line 841
        */         */
       sack2 = tmp;        sack2 = tmp;
       new_draw_info_format(NDI_UNIQUE, 0,op, "You move the items from %s into %s.",        new_draw_info_format(NDI_UNIQUE, 0,op, "You move the items from %s into %s.",
      query_name(tmp), query_name(op->container));       query_name(tmp), query_name(sack));
       for (tmp2 = tmp->inv; tmp2; tmp2 = tmp) {        for (tmp2 = tmp->inv; tmp2; tmp2 = tmp) {
    tmp = tmp2->below;     tmp = tmp2->below;
  if (sack_can_hold(op, op->container, tmp2,tmp2->nrof))       if ((sack->type == CONTAINER && sack_can_hold(op, op->container, tmp2,tmp2->nrof)) ||
    (sack->type == TRANSPORT && transport_can_hold(sack, tmp2, tmp2->nrof))) {
    put_object_in_sack (op, sack, tmp2, 0);     put_object_in_sack (op, sack, tmp2, 0);
  else {       } else {
    sprintf(buf,"Your %s fills up.", query_name(op->container));   sprintf(buf,"Your %s fills up.", query_name(sack));
    new_draw_info(NDI_UNIQUE, 0,op, buf);     new_draw_info(NDI_UNIQUE, 0,op, buf);
    break;     break;
  }   }
Line 853
 
Line 857
       return;        return;
     }      }
   
     if (! sack_can_hold (op, sack, tmp,(nrof?nrof:tmp->nrof)))      /* Don't worry about this for containers - our caller should have
        * already checked this.
        */
       if ((sack->type == CONTAINER) && !sack_can_hold (op, sack, tmp,(nrof?nrof:tmp->nrof)))
       return;        return;
   
     if(QUERY_FLAG(tmp, FLAG_APPLIED)) {      if(QUERY_FLAG(tmp, FLAG_APPLIED)) {
Line 879
 
Line 886
     } else      } else
  remove_ob(tmp);   remove_ob(tmp);
   
     sprintf(buf, "You put the %s in ", query_name(tmp));      new_draw_info_format(NDI_UNIQUE, 0,op, "You put the %s in %s.",
     strcat (buf, query_name(sack));     query_name(tmp), query_name(sack));
     strcat (buf, ".");  
     tmp_tag = tmp->count;      tmp_tag = tmp->count;
     tmp2 = insert_ob_in_ob(tmp, sack);      tmp2 = insert_ob_in_ob(tmp, sack);
     new_draw_info(NDI_UNIQUE, 0,op,buf);  
     fix_player(op); /* This is overkill, fix_player() is called somewhere */      fix_player(op); /* This is overkill, fix_player() is called somewhere */
    /* in object.c */     /* in object.c */
   
Line 895
 
Line 900
  esrv_del_item (op->contr, tmp_tag);   esrv_del_item (op->contr, tmp_tag);
   
     esrv_send_item (op, tmp2);      esrv_send_item (op, tmp2);
   
       /* If a transport, need to update all the players in the transport
        * the view of what is in it.
        */
       if (sack->type == TRANSPORT) {
    for (tmp=sack->inv; tmp; tmp=tmp->below) {
        if (tmp->type == PLAYER) tmp->contr->socket.update_look=1;
    }
       } else {
     /* update the sacks weight */      /* update the sacks weight */
     esrv_update_item (UPD_WEIGHT, op, sack);      esrv_update_item (UPD_WEIGHT, op, sack);
 }  }
   }
   
 /*  /*
  *  This function was part of drop, now is own function.   *  This function was part of drop, now is own function.
Line 946
 
Line 961
         }          }
     } else      } else
       remove_ob (tmp);        remove_ob (tmp);
   
     /* Lauwenmark: Handle for plugin drop event */      /* Lauwenmark: Handle for plugin drop event */
     if (execute_event(tmp, EVENT_DROP,op,NULL,NULL,SCRIPT_FIX_ALL)!= 0)      if (execute_event(tmp, EVENT_DROP,op,NULL,NULL,SCRIPT_FIX_ALL)!= 0)
         return;          return;
Line 1005
 
Line 1021
     if (op->type == PLAYER)      if (op->type == PLAYER)
     {      {
     op->contr->socket.update_look = 1;      op->contr->socket.update_look = 1;
 /*    esrv_send_item (op, tmp);*/  
     /* Need to update the weight for the player */      /* Need to update the weight for the player */
     esrv_send_item (op, op);      esrv_send_item (op, op);
     }      }
Line 1777
 
Line 1792
     while(' '==*params) params++;      while(' '==*params) params++;
   
     /* Checking the first part */      /* Checking the first part */
     if (itemnumber = atoi(params)) {      if ((itemnumber = atoi(params))!=0) {
  for (item=op->inv; item && ((item->count != itemnumber) || item->invisible); item=item->below);   for (item=op->inv; item && ((item->count != itemnumber) || item->invisible); item=item->below);
  if (!item) {   if (!item) {
      new_draw_info(NDI_UNIQUE,0,op,"Tried to rename an invalid item.");       new_draw_info(NDI_UNIQUE,0,op,"Tried to rename an invalid item.");


Legend:
line(s) removed in v.1.76 
line(s) changed
 line(s) added in v.1.77

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:28