#import "RaceDayDefaultController.h"

@implementation RaceDayDefaultController

- init
	{
	[super init];
	[self setDatabase:"RaceDay"];
	[self registerDefaults];
	return self;
	}
	
	
- registerDefaults
	{
	NXSize size;
	[self default:"raceLaps" toIntValue:100];
	[self default:"raceOpponents" toIntValue:20];
	[self default:"racerCarColor1"
			toColorValue:NXConvertRGBAToColor(1.0,0.4,0.0,1.0)];
	[self default:"racerCarColor2"
			toColorValue:NXConvertRGBAToColor(0.0,1.0,0.5,1.0)];
	[self default:"racerMaxSpeed" toFloatValue:210.0];
	size.height = .5,	size.width = 1.15;
	[self default:"raceTrackOvalSize" toSizeValue:&size];
	return [super registerDefaults];
	}
	

- setAll:sender
	{
	[self setIntValue:"raceLaps" to:[sender raceLaps]];
	[self setIntValue:"raceOpponents" to:[sender raceOpponents]];
	[self setColorValue:"racerCarColor1" to:[sender racerCarColor1]];
	[self setColorValue:"racerCarColor2" to:[sender racerCarColor2]];
	[self setFloatValue:"racerMaxSpeed" to:[sender racerMaxSpeed]];
	[self setSizeValue:"raceTrackOvalSize" to:[sender raceTrackOvalSize]];
	return self;
	}


- (int)raceLaps
	{
	return [self intValue:"raceLaps"];
	}


- (int)raceOpponents
	{
	return [self intValue:"raceOpponents"];
	}


- (NXColor)racerCarColor1
	{
	return [self colorValue:"racerCarColor1"];
	}
	

- (NXColor)racerCarColor2
	{
	return [self colorValue:"racerCarColor2"];
	}
	

- (float)racerMaxSpeed
	{
	return [self floatValue:"racerMaxSpeed"];
	}


- (NXSize *)raceTrackOvalSize
	{
	return [self get:&raceTrackOvalSize sizeValue:"raceTrackOvalSize"];
	}

@end
