cocoaTouch/GameSetup.m
changeset 2716 b9ca1bfca24f
parent 2705 2b5625c4ec16
child 2734 fb9ad1587054
equal deleted inserted replaced
2715:0e4e0db79e2a 2716:b9ca1bfca24f
    18 @synthesize systemSettings;
    18 @synthesize systemSettings;
    19 
    19 
    20 -(id) init {
    20 -(id) init {
    21 	self = [super init];
    21 	self = [super init];
    22 	srandom(time(NULL));
    22 	srandom(time(NULL));
    23 	ipcPort = (random() % 64541) + 1024 ;//(arc4random() % ((unsigned)64541)) + 1024;
    23 	ipcPort = (random() % 64541) + 1025;
    24 		
    24 		
    25 	NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"];
    25 	NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"];
    26 	self.systemSettings = [[NSDictionary alloc] initWithContentsOfFile:filePath]; //should check it exists
    26 	self.systemSettings = [[NSDictionary alloc] initWithContentsOfFile:filePath]; //should check it exists
    27 	return self;
    27 	return self;
    28 }
    28 }
    65 		exit(EXIT_FAILURE);
    65 		exit(EXIT_FAILURE);
    66 	}
    66 	}
    67 	
    67 	
    68 	/* Open a connection with the IP provided (listen on the host's port) */
    68 	/* Open a connection with the IP provided (listen on the host's port) */
    69 	if (!(sd = SDLNet_TCP_Open(&ip))) {
    69 	if (!(sd = SDLNet_TCP_Open(&ip))) {
    70 		NSLog(@"SDLNet_TCP_Open: %s\n", SDLNet_GetError());
    70 		NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), ipcPort);
    71 		exit(EXIT_FAILURE);
    71 		exit(EXIT_FAILURE);
    72 	}
    72 	}
    73 	
    73 	
    74 	NSLog(@"engineProtocol - Waiting for a client on port %d", ipcPort);
    74 	NSLog(@"engineProtocol - Waiting for a client on port %d", ipcPort);
    75 	serverQuit = NO;
    75 	serverQuit = NO;