
#import "NXIGameBrain.h"
#import "NXIPlayer.h"
#import <stdio.h>
#import <string.h>

@implementation NXIGameBrain

- makeGameInfo
{	// This could be replaced by using the GameInfo palette.  I'm not using
	// the palette yet since the GameInfo object may change, and then trying
	// to load the .nib might crash until I add versioning in the read and
	// write methods...
	id info = [super makeGameInfo];

	// Set up for the sound in our game; 1 type with 3 sounds.
	// 2 streams is enough to overlap the sounds a little without them
	// getting too delayed.
	[[[info setnumSoundTypes:1] setnumSoundStreams:2] setnumSounds:3];

	// Giving three bases to begin with.
	[info setNumOneUps:3];

	// highscores:  only five per user on the network server:
	[info setMaxScoresPerPlayerTable:0 net:YES to:5];
	return info;
}

- appDidInit:sender		// after init, but before 1st event.
{	// Allocate the bonus tracker and a frame for the PlayerUpView
	id xtraManTracker = [[BonusTracker alloc] init];
	NXRect baseFrame = {{0, 0}, {BASE_WIDTH, BASE_HEIGHT}};
	
	[super appDidInit:sender];
	
	// set up bonus tracker for getting extra men
	[xtraManTracker setBaseValue:10000];	// first xtra man at 10,000 pts.
	[(BonusTracker *)xtraManTracker setIncrement:10000];
										// next xtra every 15,000 pts...
	// configure the PlayerUpView
	[oneUpView setImage:[NXImage findImageNamed:"Base.tiff"]];
	[oneUpView setImageFrame:&baseFrame];
	[oneUpView setMargin:8.0];
	[oneUpView setExtraManBonusTracker:xtraManTracker];	
    return self;
}

@end
