ftp.nice.ch/pub/next/games/card/Solitaire.2.1.s.tar.gz#/Solitaire.2.1.s/Pyramid/PyramidPrefs.m

This is PyramidPrefs.m in view mode; [Download] [Up]

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

#import "PyramidPrefs.h"

@implementation PyramidPrefs

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

- registerPrefs
{
    const char *scorestr;
    
    const NXDefaultsVector gameDefaults =
    {
        {"Score", "0"},
        {NULL, NULL}
    };

    NXRegisterDefaults(gameName, gameDefaults);

    scorestr = NXGetDefaultValue(gameName, "Score");
    theScore = atoi(scorestr);
    [score setStringValue:scorestr at:0];
    return self;
}

/*---------------------------------------------------------------------------
|
|    - pyramidScore
|
|    returns: (int) the current score
|
|----------------------------------------------------------------------------
|
|    Return the current score.
|			
\---------------------------------------------------------------------------*/

- (int)pyramidScore
{
    return theScore;
}

/*---------------------------------------------------------------------------
|
|    - setPyramidScore:(int)aScore
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Set the current score.
|			
\---------------------------------------------------------------------------*/

- setPyramidScore:(int)aScore
{
    char str[16];
    theScore = aScore;
    sprintf(str, "%d", aScore);
    NXWriteDefault(gameName, "Score", str);
    [score setStringValue:str at:0];
    return self;
}

- resetScore:sender
{
    [self setPyramidScore:0];
    return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.