Esempio n. 1
0
        public bool MoveItemFromThisInventoryTo(IInventory targetInventory, ItemType itemType, int amount)
        {
            Commitment mergedCommitement = Commitment.MergeCommitmentsOfThisType(itemType, this, targetInventory);

            if (mergedCommitement == null || mergedCommitement.amount < amount)
            {
                throw new InventoryException(
                          "There is no commitment of this amount: " + amount + " of type " + itemType);
            }

            mergedCommitement.FullfillCommitmentAtomic(amount);
            return(true);
        }