|
From: Geisschaes <gei...@us...> - 2005-02-07 21:16:50
|
Update of /cvsroot/macattrick/macattrick In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16404 Modified Files: FormulasViewController.h FormulasViewController.m HattrickOrg.m LineUpController.m Player.m PlayerDetailsController.m PositionsController.m TryPlayerController.m Added Files: PositionHeap.h PositionHeap.m Log Message: PositionHeap introduced, export function started Index: LineUpController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/LineUpController.m,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** LineUpController.m 24 Jan 2005 20:18:27 -0000 1.17 --- LineUpController.m 7 Feb 2005 21:15:39 -0000 1.18 *************** *** 28,31 **** --- 28,33 ---- #import "LineUpController.h" + #import "PositionHeap.h" + @implementation LineUpController *************** *** 108,112 **** positions = [NSMutableArray arrayWithCapacity:11]; // keeper at index 0 ! [positions insertObject:[Position positionWithIdentifier:@"Keeper"] atIndex:0]; // central defenders at index 1 and 2 [self loadCentralDefender]; --- 110,114 ---- positions = [NSMutableArray arrayWithCapacity:11]; // keeper at index 0 ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Keeper"] atIndex:0]; // central defenders at index 1 and 2 [self loadCentralDefender]; *************** *** 123,131 **** - (NSArray*) substitutesPositions { NSMutableArray *subPositions = [NSMutableArray array]; ! [subPositions addObject: [Position positionWithIdentifier:@"Keeper"]]; ! [subPositions addObject: [Position positionWithIdentifier:@"Central Defender"]]; ! [subPositions addObject: [Position positionWithIdentifier:@"Inner Midfield"]]; ! [subPositions addObject: [Position positionWithIdentifier:@"Winger"]]; ! [subPositions addObject: [Position positionWithIdentifier:@"Forward"]]; return subPositions; } --- 125,133 ---- - (NSArray*) substitutesPositions { NSMutableArray *subPositions = [NSMutableArray array]; ! [subPositions addObject: [[PositionHeap uniqueInstance] positionWithIdentifier:@"Keeper"]]; ! [subPositions addObject: [[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"]]; ! [subPositions addObject: [[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"]]; ! [subPositions addObject: [[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger"]]; ! [subPositions addObject: [[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"]]; return subPositions; } *************** *** 133,158 **** - (void) loadForward { if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:9]; } if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward Defensive"] atIndex:9]; } if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:9]; } if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:9]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:10]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward Defensive"] atIndex:10]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:10]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:10]; } } --- 135,160 ---- - (void) loadForward { if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:9]; } if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward Defensive"] atIndex:9]; } if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:9]; } if([[specForward1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:9]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:10]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward Defensive"] atIndex:10]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:10]; } if([[specForward2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:10]; } } *************** *** 160,235 **** - (void) loadWinger { if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger Offensive"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger Defensive"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger Towards Middle"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:7]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger Offensive"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger Defensive"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Winger Towards Middle"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:8]; } } - (void) loadInnerMidfield { if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield Offensive"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield Defensive"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield Towards Wing"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:5]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield Offensive"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield Defensive"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield Towards Wing"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:6]; } } --- 162,237 ---- - (void) loadWinger { if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Offensive"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Defensive"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Towards Middle"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:7]; } if([[specRightWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:7]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Offensive"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Defensive"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Towards Middle"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:8]; } if([[specLeftWinger titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:8]; } } - (void) loadInnerMidfield { if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield Offensive"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield Defensive"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield Towards Wing"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:5]; } if([[specInnerMidfield1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:5]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield Offensive"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield Defensive"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield Towards Wing"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:6]; } if([[specInnerMidfield2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Central Defender",@"Extra Central Defender")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:6]; } } *************** *** 238,275 **** - (void) loadBackWings { if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback Offensive"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback Defensive"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback Towards Middle"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:3]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback Offensive"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback Defensive"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Wingback Towards Middle"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:4]; } } --- 240,277 ---- - (void) loadBackWings { if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback Offensive"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback Defensive"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback Towards Middle"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:3]; } if([[specRightBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:3]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback Offensive"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Defensive",@"Defensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback Defensive"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Middle",@"Towards Middle")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Wingback Towards Middle"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:4]; } if([[specLeftBack titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:4]; } } *************** *** 277,308 **** - (void) loadCentralDefender { if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender Offensive"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender Towards Wing"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:1]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender Offensive"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Central Defender Towards Wing"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Forward"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[Position positionWithIdentifier:@"Inner Midfield"] atIndex:2]; } } --- 279,310 ---- - (void) loadCentralDefender { if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender Offensive"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender Towards Wing"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:1]; } if([[specCentralDefender1 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:1]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Normal",@"Normal")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Offensive",@"Offensive")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender Offensive"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Towards Wing",@"Towards Wing")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Central Defender Towards Wing"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Forward",@"Extra Forward")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Forward"] atIndex:2]; } if([[specCentralDefender2 titleOfSelectedItem] isEqualToString: NSLocalizedString(@"Extra Inner Midfield",@"Extra Inner Midfield")]) { ! [positions insertObject:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Inner Midfield"] atIndex:2]; } } Index: FormulasViewController.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/FormulasViewController.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FormulasViewController.h 6 Feb 2005 19:36:17 -0000 1.2 --- FormulasViewController.h 7 Feb 2005 21:15:38 -0000 1.3 *************** *** 42,46 **** ! -(IBAction) update; - (Position *) keeper; --- 42,47 ---- ! ! - (IBAction) export:(id)sender; - (Position *) keeper; --- NEW FILE: PositionHeap.m --- //---- license ---------------------------------------------------------------// // // // Macattrick: a Manager Assistant Tool for the online Game Hattrick.org // // Copyright (C) 2004 Roman Bertolami // // // // this file is part of Macattrick application // // http://sourceforge.net/macattrick // // // // Macattrick is free software; you can redistribute it and/or // // modify it under the terms of the GNU General Public License // // as published by the Free Software Foundation; either version 2 // // of the License, or (at your option) any later version. // // // // Macattrick is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place - Suite 330, // // Boston, MA 02111-1307, USA. // // // // Macattrick, Copyright (C) 2004 Roman Bertolami // // Macattrick comes with ABSOLUTELY NO WARRANTY! // // // //---- eo licence ------------------------------------------------------------// #import "PositionHeap.h" static PositionHeap* sharedInstance; @implementation PositionHeap + (PositionHeap*) uniqueInstance { if(!sharedInstance) { sharedInstance = [[self alloc] init]; } return sharedInstance; } - (id) init { if (sharedInstance) { [self autorelease]; self = [sharedInstance retain]; } else { self = [super init]; if (self) { sharedInstance = [self retain]; } [self loadPositions]; [self loadDefaultPositions]; } return self; } -(Position*) positionWithIdentifier: (NSString*) positionsIdentifier { Position *pos = [positionsDictionary objectForKey:positionsIdentifier]; if(!pos) { pos= [self defaultPositionWithIdentifier: positionsIdentifier]; } return pos; } -(Position*) defaultPositionWithIdentifier: (NSString*) positionIdentifier { return [defaultPositionsDictionary objectForKey: positionIdentifier]; } - (NSArray*) possiblePositions { NSArray *positions = [NSArray arrayWithObjects: [self positionWithIdentifier:@"Keeper"], [self positionWithIdentifier:@"Central Defender"], [self positionWithIdentifier:@"Central Defender Towards Wing"], [self positionWithIdentifier:@"Central Defender Offensive"], [self positionWithIdentifier:@"Wingback"], [self positionWithIdentifier:@"Wingback Offensive"], [self positionWithIdentifier:@"Wingback Defensive"], [self positionWithIdentifier:@"Wingback Towards Middle"], [self positionWithIdentifier:@"Inner Midfield"], [self positionWithIdentifier:@"Inner Midfield Defensive"], [self positionWithIdentifier:@"Inner Midfield Offensive"], [self positionWithIdentifier:@"Inner Midfield Towards Wing"], [self positionWithIdentifier:@"Winger"], [self positionWithIdentifier:@"Winger Defensive"], [self positionWithIdentifier:@"Winger Offensive"], [self positionWithIdentifier:@"Winger Towards Middle"], [self positionWithIdentifier:@"Forward"], [self positionWithIdentifier:@"Forward Defensive"], nil]; return positions; } - (NSArray*) positionsIdentifiers { return [NSArray arrayWithObjects:@"Keeper", @"Central Defender",@"Central Defender Towards Wing",@"Central Defender Offensive", @"Wingback",@"Wingback Towards Middle",@"Wingback Offensive",@"Wingback Defensive", @"Inner Midfield",@"Inner Midfield Towards Wing",@"Inner Midfield Offensive" ,@"Inner Midfield Defensive", @"Winger",@"Winger Towards Middle",@"Winger Offensive",@"Winger Defensive", @"Forward",@"Forward Defensive",nil]; } - (void) loadPositions { positionsDictionary = [[NSMutableDictionary alloc]init]; NSArray *keys = [self positionsIdentifiers]; NSEnumerator *en = [keys objectEnumerator]; NSString *ident = nil; while (ident = [en nextObject]) { Position *pos = [[Position alloc] initFromUserDefaults: ident]; if(!pos) { pos = [self defaultPositionWithIdentifier:ident]; } [positionsDictionary setValue:pos forKey:ident]; [pos release]; } } - (void) loadDefaultPositions { NSArray *keys = [self positionsIdentifiers]; NSArray *objects = [[NSArray alloc] initWithObjects: [[Position alloc] initWithIdentifier:@"Keeper" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0 keeperRate:1 playmakingRate:0 scorerRate:0 passingRate:0 wingerRate:0 defenderRate:0 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Central Defender" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0.02 scorerRate:0 passingRate:0.15 wingerRate:0 defenderRate:0.75 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Central Defender Towards Wing" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0 scorerRate:0 passingRate:0.1 wingerRate:0.15 defenderRate:0.65 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Central Defender Offensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0.1 scorerRate:0 passingRate:0.2 wingerRate:0 defenderRate:0.6 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Wingback" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0 scorerRate:0 passingRate:0.1 wingerRate:0.2 defenderRate:0.6 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Wingback Towards Middle" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0 scorerRate:0 passingRate:0.08 wingerRate:0.17 defenderRate:0.65 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Wingback Offensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0.1 scorerRate:0 passingRate:0.2 wingerRate:0.25 defenderRate:0.35 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Wingback Defensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.05 keeperRate:0 playmakingRate:0 scorerRate:0 passingRate:0.05 wingerRate:0.1 defenderRate:0.8 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Inner Midfield" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.25 keeperRate:0 playmakingRate:0.5 scorerRate:0 passingRate:0.15 wingerRate:0 defenderRate:0.1 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Inner Midfield Towards Wing" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.2 keeperRate:0 playmakingRate:0.35 scorerRate:0 passingRate:0.15 wingerRate:0.2 defenderRate:0.1 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Inner Midfield Offensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.2 keeperRate:0 playmakingRate:0.5 scorerRate:0 passingRate:0.25 wingerRate:0 defenderRate:0.05 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Inner Midfield Defensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.15 keeperRate:0 playmakingRate:0.5 scorerRate:0 passingRate:0.15 wingerRate:0 defenderRate:0.2 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Winger" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.15 keeperRate:0 playmakingRate:0.25 scorerRate:0 passingRate:0.05 wingerRate:0.5 defenderRate:0.05 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Winger Towards Middle" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.15 keeperRate:0 playmakingRate:0.3 scorerRate:0 passingRate:0.1 wingerRate:0.35 defenderRate:0.1 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Winger Offensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.15 keeperRate:0 playmakingRate:0.15 scorerRate:0 passingRate:0.1 wingerRate:0.6 defenderRate:0 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Winger Defensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0.2 scorerRate:0 passingRate:0.1 wingerRate:0.35 defenderRate:0.25 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Forward" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0 scorerRate:0.6 passingRate:0.3 wingerRate:0 defenderRate:0 setPiecesRate:0], [[Position alloc] initWithIdentifier:@"Forward Defensive" playerFormRate: 0.6 experienceRate: 0.35 staminaRate:0.1 keeperRate:0 playmakingRate:0.13 scorerRate:0.45 passingRate:0.32 wingerRate:0 defenderRate:0 setPiecesRate:0], nil]; defaultPositionsDictionary = [[NSDictionary alloc] initWithObjects:objects forKeys:keys]; [objects release]; } - (void) setPosition: (Position*) position { [positionsDictionary setObject: position forKey:[position identifier]]; } - (void) saveToFile: (NSString *) filename { [positionsDictionary writeToFile:filename atomically:NO]; } - savePositionsToUserDefaults { NSEnumerator *en = [positionsDictionary objectEnumerator]; Position *current; while(current = [en nextObject]) { [current saveToUserDefaults]; } } @end Index: Player.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Player.m,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Player.m 6 Feb 2005 19:36:18 -0000 1.20 --- Player.m 7 Feb 2005 21:15:39 -0000 1.21 *************** *** 29,32 **** --- 29,33 ---- #import "Player.h" #import "World.h" + #import "PositionHeap.h" @interface Player(Private) *************** *** 367,371 **** -(Position*) bestPosition { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ! NSArray *possiblePositions = [Position possiblePositions]; NSEnumerator *en = [possiblePositions objectEnumerator]; Position *currentPosition; --- 368,372 ---- -(Position*) bestPosition { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ! NSArray *possiblePositions = [[PositionHeap uniqueInstance] possiblePositions]; NSEnumerator *en = [possiblePositions objectEnumerator]; Position *currentPosition; Index: FormulasViewController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/FormulasViewController.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FormulasViewController.m 6 Feb 2005 19:36:18 -0000 1.2 --- FormulasViewController.m 7 Feb 2005 21:15:39 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- #import "FormulasViewController.h" #import "Position.h" + #import "PositionHeap.h" @interface FormulasViewController (Private) *************** *** 47,51 **** - (void) loadPositions { ! [self setKeeper: [[Position positionWithIdentifier:@"Keeper"] copy]]; } --- 48,52 ---- - (void) loadPositions { ! [self setKeeper: [[[PositionHeap uniqueInstance] positionWithIdentifier:@"Keeper"] copy]]; } *************** *** 54,59 **** } -(void) ok { ! [Position setPosition: keeper]; ! [Position savePositionsToUserDefaults]; } --- 55,60 ---- } -(void) ok { ! [[PositionHeap uniqueInstance] setPosition: keeper]; ! [[PositionHeap uniqueInstance] savePositionsToUserDefaults]; } *************** *** 76,80 **** } ! @end --- 77,89 ---- } ! - (IBAction)export:(id)sender { ! [self ok]; ! NSSavePanel *sp = [NSSavePanel savePanel]; ! int runResult; ! runResult = [sp runModalForDirectory:NSHomeDirectory() file:@"MacattrickPositions.xml"]; ! if (runResult == NSOKButton) { ! [[PositionHeap uniqueInstance] saveToFile:[sp filename]]; ! } ! } @end Index: TryPlayerController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/TryPlayerController.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TryPlayerController.m 22 Jul 2004 15:29:42 -0000 1.2 --- TryPlayerController.m 7 Feb 2005 21:15:40 -0000 1.3 *************** *** 28,32 **** #import "TryPlayerController.h" ! @implementation TryPlayerController --- 28,32 ---- #import "TryPlayerController.h" ! #import "PositionHeap.h" @implementation TryPlayerController *************** *** 39,44 **** - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex{ ! SEL selector = NSSelectorFromString([NSString stringWithFormat:@"position%s",[[aTableColumn identifier] cString]]); ! id position = [Position performSelector: selector]; return [NSNumber numberWithDouble: [player calculatePositionValue:position]]; } --- 39,47 ---- - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex{ ! // SEL selector = NSSelectorFromString([NSString stringWithFormat:@"position%s",[[aTableColumn identifier] cString]]); ! // id position = [[PositionHeap uniqueInstance] performSelector: selector]; ! // return [NSNumber numberWithDouble: [player calculatePositionValue:position]]; ! SEL selector =@selector(positionWithIdentifier:); ! id position = [[PositionHeap uniqueInstance] performSelector:selector withObject:[aTableColumn identifier] ]; return [NSNumber numberWithDouble: [player calculatePositionValue:position]]; } --- NEW FILE: PositionHeap.h --- //---- license ---------------------------------------------------------------// // // // Macattrick: a Manager Assistant Tool for the online Game Hattrick.org // // Copyright (C) 2004 Roman Bertolami // // // // this file is part of Macattrick application // // http://sourceforge.net/macattrick // // // // Macattrick is free software; you can redistribute it and/or // // modify it under the terms of the GNU General Public License // // as published by the Free Software Foundation; either version 2 // // of the License, or (at your option) any later version. // // // // Macattrick is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place - Suite 330, // // Boston, MA 02111-1307, USA. // // // // Macattrick, Copyright (C) 2004 Roman Bertolami // // Macattrick comes with ABSOLUTELY NO WARRANTY! // // // //---- eo licence ------------------------------------------------------------// #import <Cocoa/Cocoa.h> #import "Position.h" @interface PositionHeap : NSObject { NSDictionary* defaultPositionsDictionary; NSMutableDictionary *positionsDictionary; } + (PositionHeap*) uniqueInstance; - (Position*) positionWithIdentifier: (NSString*) positionsIdentifier; - (Position*) defaultPositionWithIdentifier: (NSString*) positionIdentifier; - (NSArray*) possiblePositions; - (NSArray*) positionsIdentifiers; - (void) initialize; - (void) loadPositions; - (void) loadDefaultPositions; - (void) setPosition: (Position*) position; - savePositionsToUserDefaults; - (void) saveToFile: (NSString *) filename; @end Index: PlayerDetailsController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/PlayerDetailsController.m,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PlayerDetailsController.m 24 Jan 2005 20:18:29 -0000 1.7 --- PlayerDetailsController.m 7 Feb 2005 21:15:40 -0000 1.8 *************** *** 28,32 **** #import "PlayerDetailsController.h" ! @implementation PlayerDetailsController --- 28,32 ---- #import "PlayerDetailsController.h" ! #import "PositionHeap.h" @implementation PlayerDetailsController *************** *** 103,109 **** - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex{ SEL selector =@selector(positionWithIdentifier:); ! id position = [Position performSelector:selector withObject:[aTableColumn identifier] ]; ! //SEL selector = NSSelectorFromString([NSString stringWithFormat:@"position%s",[[aTableColumn identifier] cString]]); ! //id position = [Position performSelector: selector]; return [NSNumber numberWithDouble: [tryPlayer calculatePositionValue:position]]; } --- 103,107 ---- - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex{ SEL selector =@selector(positionWithIdentifier:); ! id position = [[PositionHeap uniqueInstance] performSelector:selector withObject:[aTableColumn identifier] ]; return [NSNumber numberWithDouble: [tryPlayer calculatePositionValue:position]]; } Index: PositionsController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/PositionsController.m,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PositionsController.m 24 Jan 2005 20:18:30 -0000 1.7 --- PositionsController.m 7 Feb 2005 21:15:40 -0000 1.8 *************** *** 30,33 **** --- 30,34 ---- #import "MainController.h" #import "Position.h" + #import "PositionHeap.h" @implementation PositionsController *************** *** 66,70 **** // SEL selector = NSSelectorFromString([NSString stringWithFormat:@"position%s",[[aTableColumn identifier] cString]]); SEL selector =@selector(positionWithIdentifier:); ! id position = [Position performSelector:selector withObject:[aTableColumn identifier] ]; return [NSNumber numberWithDouble: [player calculatePositionValue:position]]; } --- 67,71 ---- // SEL selector = NSSelectorFromString([NSString stringWithFormat:@"position%s",[[aTableColumn identifier] cString]]); SEL selector =@selector(positionWithIdentifier:); ! id position = [[PositionHeap uniqueInstance] performSelector:selector withObject:[aTableColumn identifier] ]; return [NSNumber numberWithDouble: [player calculatePositionValue:position]]; } *************** *** 113,118 **** static int comparePosition(id player1, id player2, void *positionIdentifier){ NSString *positionID = positionIdentifier; ! int result = [player1 compareDouble: [player1 calculatePositionValue: [Position positionWithIdentifier:positionID]] ! otherDouble: [player2 calculatePositionValue: [Position positionWithIdentifier:positionID]]]; return result; } --- 114,119 ---- static int comparePosition(id player1, id player2, void *positionIdentifier){ NSString *positionID = positionIdentifier; ! int result = [player1 compareDouble: [player1 calculatePositionValue: [[PositionHeap uniqueInstance] positionWithIdentifier:positionID]] ! otherDouble: [player2 calculatePositionValue: [[PositionHeap uniqueInstance] positionWithIdentifier:positionID]]]; return result; } Index: HattrickOrg.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/HattrickOrg.m,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** HattrickOrg.m 6 Feb 2005 19:36:18 -0000 1.17 --- HattrickOrg.m 7 Feb 2005 21:15:39 -0000 1.18 *************** *** 38,42 **** @implementation HattrickOrg ! + uniqueInstance { if(!sharedInstance) { sharedInstance = [[self alloc] init]; --- 38,42 ---- @implementation HattrickOrg ! + (HattrickOrg*) uniqueInstance { if(!sharedInstance) { sharedInstance = [[self alloc] init]; |