<commit_before>//
//  XFleet.mm
//  MultiBreakout
//
//  Created by <NAME> on 7/29/10.
//  Copyright 2010 Koduco Games. All rights reserved.
//

#import "XFleet.h"
#import "PongVaderScene.h"
#import "StationaryInvader.h"

@interface XFleet(Private)
-(void) makePhysical;
@end

@implementation XFleet

- (id) initWithSize:(int) size andSpacing:(int) spacing atHeight:(int) height upsideDown:(BOOL) upsidedown stationary: (BOOL) stat difficulty: (int) level {
	if ((self = [super init])) {
		CGSize screenSize = [CCDirector sharedDirector].winSize;
		PongVader *pv = [PongVader getInstance];
		
		//float left = screenSize.width / 2.0 - ((size-1)/4 +1)*spacing;
		float left = screenSize.width / 2.0;
		for(int i = 0; i < size; i++) {
			//StationaryInvader *invader;
			
			int row = (int) ((i-1)/4 + 1);
			CGPoint pos; // ccp(left + i * spacing, height)
			
			// first invader goes smack in the center
			if (i == 0) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000, height) withForce:ccp(0,0)];
				pos = ccp(left + i * spacing, height);
			}
			
			// top right (+spacing, +spacing)
			else if (i % 4 == 0) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 + row*spacing, height +(row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left + row*spacing, height +(row*spacing));
			}
			
			// bottom right (+spacing, -spacing)
			else if (i % 4 == 1) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 + row*spacing, height - (row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left + row*spacing, height - (row*spacing));
			}
			
			// bottom left (-spacing, -spacing)
			else if (i % 4 == 2) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 - row*spacing, height - (row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left - row*spacing, height - (row*spacing));
			}
			
			// top left (-spacing, +spacing)
			else if (i % 4 == 3) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 - row*spacing, height + (row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left - row*spacing, height + (row*spacing));
			}
			
			SpriteBody<Shooter> *invader;
			
			if (stat) {
				invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];	
			}
			else {
				int type = arc4random() % 4;
				
				switch (type) {
					case 0:
						invader = (ENSPrance *) [pv addSpriteBody:[ENSPrance class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					case 1:
						invader = (LTWaddle *) [pv addSpriteBody:[LTWaddle class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					case 2:
						invader = (CDRBobble *) [pv addSpriteBody:[CDRBobble class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					case 3:
						invader = (ShieldInvader *) [pv addSpriteBody:[ShieldInvader class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					default:
						break;
				}
			}
			
			int promote = arc4random() % 3;
			if (promote == 1) {
				[invader promote: level];
			}
			
			printf("i: %d row: %d\n", i, row);
			
			invader.scale = LINEFLEET_START_SIZE;
			if (i%2 == upsidedown) invader.rotation = 180;
			[_invaders addObject:invader];<commit_msg>XFleet: fix warning<commit_after>//
//  XFleet.mm
//  MultiBreakout
//
//  Created by <NAME> on 7/29/10.
//  Copyright 2010 Koduco Games. All rights reserved.
//

#import "XFleet.h"
#import "PongVaderScene.h"
#import "StationaryInvader.h"

@interface XFleet(Private)
-(void) makePhysical;
@end

@implementation XFleet

- (id) initWithSize:(int) size andSpacing:(int) spacing atHeight:(int) height upsideDown:(BOOL) upsidedown stationary: (BOOL) stat difficulty: (int) level {
	if ((self = [super init])) {
		CGSize screenSize = [CCDirector sharedDirector].winSize;
		PongVader *pv = [PongVader getInstance];
		
		//float left = screenSize.width / 2.0 - ((size-1)/4 +1)*spacing;
		float left = screenSize.width / 2.0;
		for(int i = 0; i < size; i++) {
			//StationaryInvader *invader;
			
			int row = (int) ((i-1)/4 + 1);
			CGPoint pos; // ccp(left + i * spacing, height)
			
			// first invader goes smack in the center
			if (i == 0) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000, height) withForce:ccp(0,0)];
				pos = ccp(left + i * spacing, height);
			}
			
			// top right (+spacing, +spacing)
			else if (i % 4 == 0) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 + row*spacing, height +(row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left + row*spacing, height +(row*spacing));
			}
			
			// bottom right (+spacing, -spacing)
			else if (i % 4 == 1) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 + row*spacing, height - (row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left + row*spacing, height - (row*spacing));
			}
			
			// bottom left (-spacing, -spacing)
			else if (i % 4 == 2) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 - row*spacing, height - (row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left - row*spacing, height - (row*spacing));
			}
			
			// top left (-spacing, +spacing)
			else if (i % 4 == 3) {
				//invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 - row*spacing, height + (row*spacing)) withForce:ccp(0,0)];
				pos = ccp(left - row*spacing, height + (row*spacing));
			}
			
			SpriteBody<Shooter> *invader;
			
			if (stat) {
				invader = (StationaryInvader *) [pv addSpriteBody:[StationaryInvader class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];	
			}
			else {
				int type = arc4random() % 4;
				
				switch (type) {
					case 0:
						invader = (ENSPrance *) [pv addSpriteBody:[ENSPrance class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					case 1:
						invader = (LTWaddle *) [pv addSpriteBody:[LTWaddle class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					case 2:
						invader = (CDRBobble *) [pv addSpriteBody:[CDRBobble class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					case 3:
						invader = (ShieldInvader *) [pv addSpriteBody:[ShieldInvader class] atPos:ccp(upsidedown ? -300 : 1000 + pos.x, pos.y) withForce:ccp(0,0)];
						break;
					default:
                        invader = nil;
						break;
				}
			}
			
			int promote = arc4random() % 3;
			if (promote == 1) {
				[invader promote: level];
			}
			
			printf("i: %d row: %d\n", i, row);
			
			invader.scale = LINEFLEET_START_SIZE;
			if (i%2 == upsidedown) invader.rotation = 180;
			[_invaders addObject:invader];
{'fraction_non_alphanumeric': 0.16113939727535434, 'fraction_numerical': 0.03632860877941379, 'mean_word_length': 3.2157772621809744, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '183578', 'n_tokens_mistral': 3377, 'n_tokens_neox': 2655, 'n_words': 639}