Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF 0.91.7-patch drop from container



If you have a container (A) open and you drop items from an active container
(B) the drop may fail as the A is full or doesn't accept the item type.  This
would cause an infinite loop.


*** server/player.OLD	Tue Jan 31 00:52:35 1995
--- server/player.c	Tue Jan 31 00:58:16 1995
***************
*** 1545,1556 ****
  	  draw_inventory(op);
  	return 1;
         case 3:
  	if(tmp->type==CONTAINER && QUERY_FLAG(tmp,FLAG_APPLIED)) {
  	  if(op->container==tmp) return 1; /* fix an endless loop problem */
! 	  for(inv=tmp->inv;inv!=NULL;inv=tmp->inv)
  	    drop(op,inv);
  	}
  	else drop(op,tmp);
  	return 1;
        }
        return 1;
--- 1545,1560 ----
  	  draw_inventory(op);
  	return 1;
         case 3:
  	if(tmp->type==CONTAINER && QUERY_FLAG(tmp,FLAG_APPLIED)) {
  	  if(op->container==tmp) return 1; /* fix an endless loop problem */
! 	  for(inv=tmp->inv;inv!=NULL;) {
! 	    /* The drop may fail if dropping from container TO container */
! 	    tmp=inv->below;
  	    drop(op,inv);
+ 	    inv=tmp;
+ 	  }
  	}
  	else drop(op,tmp);
  	return 1;
        }
        return 1;