
#import "FTDrawDelegate.h"
#import <Solitaire/CardSet.h>
#import "localstrings.h"

@implementation FTDrawDelegate

- (void) setDiscardCardPileView:(CardPileView*)theView
{
    discardPileView = theView; 
}


- (void) clickedCard:(Card*)aCard in:(CardPileView*)drawCardPileView
{
    CardPile*   drawCardPile = [drawCardPileView cardPile];
    CardPile*   discardPile = [discardPileView cardPile];
    Card*    	drawCard;
    
    if ([drawCardPile cardCount]) {
        [[drawCardPileView window] disableFlushWindow];
        drawCard = [drawCardPile dealTopCard];
        [drawCard flip];
        [discardPile addCard:drawCard];
        [drawCardPileView display];
        [discardPileView display];
        [[drawCardPileView window] enableFlushWindow];
        [[drawCardPileView window] flushWindow];
    }
    else{
        NSRunAlertPanel(LOCALIZED_GAME_NAME, LOCALIZED_NO_STOCK_CARD, @"OK", nil, nil);
    } 
}

@end

