This is DiscardCardPileDelegate.m in view mode; [Download] [Up]
/* indent:4 tabsize:8 font:fixed-width */
#import "DiscardCardPileDelegate.h"
#import <Solitaire/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:(CardPile*)aCardPile from:sender in:(CardPileView*)discardCardPileView
{
/*---------------------------------------------------------------------
*
* Only Kings may be dropped directly on the match piles.
*
*--------------------------------------------------------------------*/
if ([[aCardPile topCard] value] == CS_KING)
{
return YES;
}
return NO;
}
/*--------------------------------------------------------------------------
|
| - acceptPile:aCardPile in:discardCardPileView
|
|---------------------------------------------------------------------------
|
| Called by a discardCardPileView when a card pile has been dropped on
| the pile.
|
\---------------------------------------------------------------------------*/
- (void) acceptPile:(CardPile*)aCardPile in:(CardPileView*)discardCardPileView
{
[[Pyramid sharedInstance] checkForWin];
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.