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

#import "Template.h"
#import "localstrings.h"

@implementation Template


/*---------------------------------------------------------------------------
|
|    - initFromBundle:aBundle withName:(const char *)name
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Instantiate an object of this class.
|			
\---------------------------------------------------------------------------*/

- initFromBundle:aBundle withName:(const char *)name
{
    [super initFromBundle:aBundle withName:name];
    
    // ****custom code here****
    
    return self;
}


/*---------------------------------------------------------------------------
|
|    - inspectorWillBeRemoved
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Sent by game engine just before removing this module's inspector from
|    view.
|			
\----------------------------------------------------------------------------*/

- inspectorWillBeRemoved
{
    // ****custom code here****
    
    return self;
}

/*---------------------------------------------------------------------------
|
|    - inspectorInstalled
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Sent by game engine just after installing this module's inspector.
|			
\----------------------------------------------------------------------------*/

- inspectorInstalled
{
    // ****custom code here****
    
    return self;
}


/*---------------------------------------------------------------------------
|
|    - startGame:
|
|    returns:    (id)  self
|
|----------------------------------------------------------------------------
|
|    Start a new game.  Get confirmation from the user before aborting a 
|    game in progress.
|			
\----------------------------------------------------------------------------*/

- startGame:sender
{
    [super startGame:sender];
    return [self setupGame:YES];
}


/*---------------------------------------------------------------------------
|
|    - restartGame:
|
|    returns:  (id) self
|
|----------------------------------------------------------------------------
|
|    Restart the game in progress.
|			
\----------------------------------------------------------------------------*/

- restartGame:sender
{
    [super restartGame:sender];
    return [self setupGame:NO];
}


/*---------------------------------------------------------------------------
|
|    - setupGame:(BOOL)redeal
|
|    returns:  (id) self
|
|----------------------------------------------------------------------------
|
|    Setup a new game.  If "redeal" is true, deal a new deck, otherwise
|    use the same cards as the previous game.
|			
\----------------------------------------------------------------------------*/

- setupGame:(BOOL)redeal
{
    // ****custom code here****

    // pop the game window to the front
    [gameWindow makeKeyAndOrderFront:self];

    return self;
}


/*---------------------------------------------------------------------------
|
|    - endGame:sender
|
|    returns:  (id) self
|
|----------------------------------------------------------------------------
|
|    End the game in progress.  Discard the game window.
|			
\----------------------------------------------------------------------------*/

- endGame:sender
{
    // close the game window
    [super endGame:sender];

    // ****custom code here****
    
    return self;
}

/*---------------------------------------------------------------------------
|
|    - win
|
|     returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Called when the game has been won.  This is where you can insert fancy
|    winning routines, or just call the default (boring) routine.
|
\----------------------------------------------------------------------------*/

- win
{
    [super win];  // replace this with something wonderful
    return self;
}


/*---------------------------------------------------------------------------
|
|    - lose
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Called when the game has been lost.  Most games probably won't bother
|    to check if they have lost.
|
\----------------------------------------------------------------------------*/

- lose
{
    [super lose];  // replace this with something wonderful
    return self;
}

/*---------------------------------------------------------------------------
|
|    - checkForWin
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Called to check the state of the game.  Always override (unless your
|    game is impossible to win).
|
\----------------------------------------------------------------------------*/

- checkForWin
{
#ifdef FILL_THIS_IN_YOURSELF
    if (I win the game)
    {
        [self win];
    }
#endif
    return self;
}

@end

