/* indent:4  tabsize:8  font:fixed-width */

#import "DiscardCardPileDelegate.h"
#import "../Solitaire/CardSet.subproj/cardset.h"
#import "Pyramid.h"


@implementation DiscardCardPileDelegate

/*-------------------------------------------------------------------------
|
|    - (BOOL)canAcceptPile:aCardPile from:sender in:discardCardPileView
|
|    returns:	(BOOL)	YES if this pile will accept the cards dropped on it
|
|		(BOOL)	NO if this pile will not accept the dropped cards
|
|--------------------------------------------------------------------------
|
|	Called by a DiscardCardPileView when a card pile wants to be dropped 
|	on this it.
|	
\-------------------------------------------------------------------------*/

- (BOOL)canAcceptPile:aCardPile from:sender in:discardCardPileView
{

    /*---------------------------------------------------------------------
     *
     * Only Kings may be dropped directly on the match piles.
     *
     *--------------------------------------------------------------------*/
    
    if ([[aCardPile cardAt:CS_TOP] value] == CS_KING)
    {
	return YES;
    }
    return NO;
}


/*--------------------------------------------------------------------------
|
|	- acceptPile:aCardPile in:discardCardPileView
|
|	returns:		(id)			self
|
|---------------------------------------------------------------------------
|
|	Called by a discardCardPileView when a card pile has been dropped on 
|	the pile.
|	
\---------------------------------------------------------------------------*/

- acceptPile:aCardPile in:discardCardPileView
{
    [SolGameController() checkForWin];
    return self;
}

@end
