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

#import "TenpilePrefs.h"

@implementation TenpilePrefs

/*---------------------------------------------------------------------------
|
|    - registerPrefs
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Register the preferences for this game.  Called automatically.
|			
\---------------------------------------------------------------------------*/

- registerPrefs
{
    const NXDefaultsVector gameDefaults =
    {
        {"HiddenCards", "3"},
        {NULL, NULL}
    };

    NXRegisterDefaults(gameName, gameDefaults);

    hiddenCards = atoi(NXGetDefaultValue(gameName, "HiddenCards"));
    if (hiddenCards < 0)
      hiddenCards = 0;
    if (hiddenCards > 4)
      hiddenCards = 4;
    [hiddenCardsMatrix selectCellWithTag:hiddenCards];

    return self;
}


- saveHiddenCards:sender
{
    char buffer[80];

    hiddenCards = [hiddenCardsMatrix selectedTag];
    sprintf(buffer, "%d", hiddenCards);
    NXWriteDefault(gameName, "HiddenCards", buffer);
    return self;
}


- (int) hiddenCards
{
    return hiddenCards;
}

@end
