equal
deleted
inserted
replaced
196 [self sendToEngine:@"e$landadds 4"]; |
196 [self sendToEngine:@"e$landadds 4"]; |
197 [self sendToEngine:@"e$sd_turns 15"]; |
197 [self sendToEngine:@"e$sd_turns 15"]; |
198 [self sendToEngine:@"e$casefreq 5"]; |
198 [self sendToEngine:@"e$casefreq 5"]; |
199 |
199 |
200 // dimension of the map |
200 // dimension of the map |
201 [self sendToEngine:@"e$template_filter 1"]; |
201 [self sendToEngine:[self.gameConfig objectForKey:@"templatefilter_command"]]; |
|
202 [self sendToEngine:[self.gameConfig objectForKey:@"mapgen_command"]]; |
|
203 [self sendToEngine:[self.gameConfig objectForKey:@"mazesize_command"]]; |
202 |
204 |
203 // theme info |
205 // theme info |
204 [self sendToEngine:@"etheme Compost"]; |
206 [self sendToEngine:@"etheme Compost"]; |
205 |
207 |
206 NSArray *teamsConfig = [self.gameConfig objectForKey:@"teams_list"]; |
208 NSArray *teamsConfig = [self.gameConfig objectForKey:@"teams_list"]; |
288 } |
290 } |
289 |
291 |
290 SDLNet_TCP_Close(sd); |
292 SDLNet_TCP_Close(sd); |
291 SDLNet_Quit(); |
293 SDLNet_Quit(); |
292 |
294 |
|
295 [[NSFileManager defaultManager] removeItemAtPath:GAMECONFIG_FILE() error:NULL]; |
|
296 |
293 [pool release]; |
297 [pool release]; |
294 [NSThread exit]; |
298 [NSThread exit]; |
295 } |
299 } |
296 |
300 |
297 #pragma mark - |
301 #pragma mark - |
300 NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; |
304 NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; |
301 NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; |
305 NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; |
302 CGRect screenBounds = [[UIScreen mainScreen] bounds]; |
306 CGRect screenBounds = [[UIScreen mainScreen] bounds]; |
303 NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width]; |
307 NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width]; |
304 NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height]; |
308 NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height]; |
305 const char **gameArgs = (const char**) malloc(sizeof(char*) * 8); |
309 const char **gameArgs = (const char**) malloc(sizeof(char *) * 8); |
306 |
310 |
307 /* |
311 /* |
308 size_t size; |
312 size_t size; |
309 // Set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space |
313 // Set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space |
310 sysctlbyname("hw.machine", NULL, &size, NULL, 0); |
314 sysctlbyname("hw.machine", NULL, &size, NULL, 0); |
331 username = [[NSString alloc] initWithFormat:@"MobileUser-%@",ipcString]; |
335 username = [[NSString alloc] initWithFormat:@"MobileUser-%@",ipcString]; |
332 } else { |
336 } else { |
333 username = [[NSString alloc] initWithString:originalUsername]; |
337 username = [[NSString alloc] initWithString:originalUsername]; |
334 } |
338 } |
335 |
339 |
336 gameArgs[0] = [username UTF8String]; //UserNick |
340 gameArgs[0] = [username UTF8String]; //UserNick |
337 gameArgs[1] = [ipcString UTF8String]; //ipcPort |
341 gameArgs[1] = [ipcString UTF8String]; //ipcPort |
338 gameArgs[2] = [[[self.systemSettings objectForKey:@"sound"] stringValue] UTF8String]; //isSoundEnabled |
342 gameArgs[2] = [[[self.systemSettings objectForKey:@"sound"] stringValue] UTF8String]; //isSoundEnabled |
339 gameArgs[3] = [[[self.systemSettings objectForKey:@"music"] stringValue] UTF8String]; //isMusicEnabled |
343 gameArgs[3] = [[[self.systemSettings objectForKey:@"music"] stringValue] UTF8String]; //isMusicEnabled |
340 gameArgs[4] = [localeString UTF8String]; //cLocaleFName |
344 gameArgs[4] = [localeString UTF8String]; //cLocaleFName |
341 gameArgs[5] = [[[self.systemSettings objectForKey:@"alternate"] stringValue] UTF8String]; //cAltDamage |
345 gameArgs[5] = [[[self.systemSettings objectForKey:@"alternate"] stringValue] UTF8String]; //cAltDamage |
342 gameArgs[6] = [wSize UTF8String]; //cScreenHeight |
346 gameArgs[6] = [wSize UTF8String]; //cScreenHeight |
343 gameArgs[7] = [hSize UTF8String]; //cScreenWidth |
347 gameArgs[7] = [hSize UTF8String]; //cScreenWidth |
344 |
348 |
345 [wSize release]; |
349 [wSize release]; |
346 [hSize release]; |
350 [hSize release]; |
347 [localeString release]; |
351 [localeString release]; |
348 [ipcString release]; |
352 [ipcString release]; |