From a644cc5f3f6eb2f6be9cf5bc12b6e724c27ce15f Mon Sep 17 00:00:00 2001 From: Glen Masgai Date: Mon, 15 Nov 2010 16:40:10 +0000 Subject: [PATCH] xcode and launcher updates git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5877 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/xcode/English.lproj/InfoPlist.strings | Bin 640 -> 640 bytes source/xcode/Launcher.h | 2 - source/xcode/Launcher.m | 45 +++++++++++-------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/source/xcode/English.lproj/InfoPlist.strings b/source/xcode/English.lproj/InfoPlist.strings index 4a1616977c798a85605d69c021eae3f871339be5..19dee12047ed5ec4454222cdc23d474d97ef5e2f 100644 GIT binary patch delta 29 lcmZo*ZD5`7lhI`2uUJ+S1|0^4$sZU+C(AP>PQJvr4gi!#3HSg2 delta 29 lcmZo*ZD5`7lhJtMuUJ-N1|0^4$sZU+C(AP>PQJvr4gi!O3HAU0 diff --git a/source/xcode/Launcher.h b/source/xcode/Launcher.h index bc3bced3..b00f81d2 100644 --- a/source/xcode/Launcher.h +++ b/source/xcode/Launcher.h @@ -31,8 +31,6 @@ - (IBAction)multiplayerAction:(id)sender; -- (IBAction)playRpg:(id)sender; - - (IBAction)playMap:(id)sender; - (IBAction)openUserdir:(id)sender; diff --git a/source/xcode/Launcher.m b/source/xcode/Launcher.m index fc169af4..11d1e0cf 100644 --- a/source/xcode/Launcher.m +++ b/source/xcode/Launcher.m @@ -308,19 +308,27 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) [dict setObject:@"" forKey:@"name"]; //ensure these entries are never nil [dict setObject:@"" forKey:@"team"]; - NSString *files[] = {@"config.cfg", @"autoexec.cfg"}; + NSMutableArray *lines = [NSMutableArray array]; + NSString *files[] = {@"config/saved.cfg", @"config/autoexec.cfg"}; + int i; for(i = 0; i < sizeof(files)/sizeof(NSString*); i++) { NSString *file = [Launcher userdir]; file = [file stringByAppendingPathComponent:files[i]]; - NSArray *lines = [[NSString stringWithContentsOfFile:file] componentsSeparatedByString:@"\n"]; + [lines addObjectsFromArray:[[NSString stringWithContentsOfFile:file] componentsSeparatedByString:@"\n"]]; - if(i==0 && !lines) // ugh - special case when first run... - { - file = [[Launcher cwd] stringByAppendingPathComponent:@"config/defaults.cfg"]; - lines = [[NSString stringWithContentsOfFile:file] componentsSeparatedByString:@"\n"]; + if(i==0 && ![lines count]) // ugh - special case when first run... + { + NSString *defaultfiles[] = {@"config/defaults.cfg", @"config/resetbinds.cfg"}; + + int j; + for(j = 0; j < sizeof(defaultfiles)/sizeof(NSString*); j++) + { + file = [[Launcher cwd] stringByAppendingPathComponent:defaultfiles[j]]; + [lines addObjectsFromArray:[[NSString stringWithContentsOfFile:file] componentsSeparatedByString:@"\n"]]; + } } NSString *line; @@ -490,10 +498,15 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) { if([filename hasPrefix:@"-e"]) [cmds addObject:[filename substringFromIndex:2]]; - if([filename hasPrefix:@"--loaddemo"]) + if([filename hasPrefix:[NSString stringWithFormat:@"%@://", kASSAULTCUBE]]) [args addObject:filename]; else - [args addObject:[NSString stringWithFormat:@"--loadmap=%@", filename]]; + { + if([filename hasPrefix:@"--loaddemo"]) + [args addObject:filename]; + else + [args addObject:[NSString stringWithFormat:@"--loadmap=%@", filename]]; + } } if([cmds count] > 0) @@ -577,13 +590,12 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) //need to flush lurking config files - they're automatically generated, so no big deal... NSString *dir = [Launcher userdir]; [fm removeFileAtPath:[dir stringByAppendingPathComponent:@"init.cfg"] handler:nil]; - [fm removeFileAtPath:[dir stringByAppendingPathComponent:@"config.cfg"] handler:nil]; + [fm removeFileAtPath:[dir stringByAppendingPathComponent:@"saved.cfg"] handler:nil]; } [defs setObject:appVersion forKey:dkVERSION]; NSDictionary *dict = [self readConfigFiles]; [keys addObjects:[self getKeys:dict]]; - [self initMaps]; [self initResolutions]; @@ -649,7 +661,8 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) { NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]]; if(!url) return; - [self playFile:[NSString stringWithFormat:@"-econnect %@", [url host]]]; + [self playFile:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]]; //use the game internal parser + //[self playFile:[NSString stringWithFormat:@"-econnect %@", [url host]]]; } #pragma mark interface actions @@ -681,8 +694,9 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) int clients = [defs integerForKey:dkMAXCLIENTS]; if (clients > 0) [args addObject:[NSString stringWithFormat:@"-c%d", clients]]; - - [args addObject:[NSString stringWithFormat:@"--home%@", [Launcher userdir]]]; + + //server doesn't support --home + //[args addObject:[NSString stringWithFormat:@"--home%@", [Launcher userdir]]]; [self launchGame:args]; } @@ -694,11 +708,6 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) [self playFile:nil]; } -- (IBAction)playRpg:(id)sender -{ - [self playFile:@"-rpg"]; -} - - (IBAction)playMap:(id)sender { NSArray *sel = [maps selectedObjects];