# HG changeset patch # User koda # Date 1339624981 -7200 # Node ID ed8bd253408cee3ffc7f207d9f0ad3a91f9b480c # Parent 268a2107d176f32838fd7549e230cd7bc785eba9 ios: for mission configuration, use the bundled cfg file instead of providing plist files diff -r 268a2107d176 -r ed8bd253408c project_files/HedgewarsMobile/Classes/DefinesAndMacros.h --- a/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h Wed Jun 13 23:28:54 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h Thu Jun 14 00:03:01 2012 +0200 @@ -67,7 +67,7 @@ #define MISSIONS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"] #define TRAININGS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Training/"] #define LOCALE_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Locale/"] -#define SCRIPTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/plist/"] +#define SCRIPTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/Multiplayer/"] #define MSG_MEMCLEAN() DLog(@"has cleaned up some memory"); #define MSG_DIDUNLOAD() DLog(@"unloaded"); diff -r 268a2107d176 -r ed8bd253408c project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Wed Jun 13 23:28:54 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Thu Jun 14 00:03:01 2012 +0200 @@ -72,7 +72,8 @@ -(NSArray *)listOfScripts { if (listOfScripts == nil) - self.listOfScripts = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL]; + self.listOfScripts = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL] + filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF ENDSWITH '.lua'"]]; return listOfScripts; } @@ -202,11 +203,9 @@ self.lastIndexPath_we = indexPath; } } else { - cell.textLabel.text = [[self.listOfScripts objectAtIndex:row] stringByDeletingPathExtension]; - NSString *str = [NSString stringWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),[self.listOfScripts objectAtIndex:row]]; - NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str]; - cell.detailTextLabel.text = [dict objectForKey:@"description"]; - [dict release]; + cell.textLabel.text = [[[self.listOfScripts objectAtIndex:row] stringByDeletingPathExtension] + stringByReplacingOccurrencesOfString:@"_" withString:@" "]; + //cell.detailTextLabel.text = ; if ([[self.listOfScripts objectAtIndex:row] isEqualToString:self.selectedScript]) { UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]]; cell.accessoryView = checkbox; @@ -287,29 +286,30 @@ self.selectedScript = [self.listOfScripts objectAtIndex:newRow]; // some styles disable or force the choice of a particular scheme/weaponset - NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),self.selectedScript]; - NSDictionary *scriptDict = [[NSDictionary alloc] initWithContentsOfFile:path]; + NSString *path = [[NSString alloc] initWithFormat:@"%@/%@.cfg",SCRIPTS_DIRECTORY(),[self.selectedScript stringByDeletingPathExtension]]; + NSString *configFile = [[NSString alloc] initWithContentsOfFile:path]; [path release]; - self.scriptCommand = [scriptDict objectForKey:@"command"]; - NSString *scheme = [scriptDict objectForKey:@"scheme"]; - if ([scheme isEqualToString:@""]) { + NSArray *scriptOptions = [configFile componentsSeparatedByString:@"\n"]; + [configFile release]; + + self.scriptCommand = [NSString stringWithFormat:@"escript Scripts/Multiplayer/%@",self.selectedScript]; + NSString *scheme = [scriptOptions objectAtIndex:0]; + if ([scheme isEqualToString:@"locked"]) { self.selectedScheme = @"Default.plist"; [self.topControl setEnabled:NO forSegmentAtIndex:0]; } else { - self.selectedScheme = scheme; + self.selectedScheme = [NSString stringWithFormat:@"%@.plist",scheme]; [self.topControl setEnabled:YES forSegmentAtIndex:0]; } - NSString *weapon = [scriptDict objectForKey:@"weapon"]; - if ([weapon isEqualToString:@""]) { + NSString *weapon = [scriptOptions objectAtIndex:1]; + if ([weapon isEqualToString:@"locked"]) { self.selectedWeapon = @"Default.plist"; [self.topControl setEnabled:NO forSegmentAtIndex:1]; } else { - self.selectedWeapon = weapon; + self.selectedWeapon = [NSString stringWithFormat:@"%@.plist",weapon]; [self.topControl setEnabled:YES forSegmentAtIndex:1]; } - - [scriptDict release]; } [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; diff -r 268a2107d176 -r ed8bd253408c project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Wed Jun 13 23:28:54 2012 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Jun 14 00:03:01 2012 +0200 @@ -1472,7 +1472,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${PROJECT_DIR}/../AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n then\n mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\nif ((`ls ${PROJECT_DIR}/Data/Scripts/Multiplayer/*.lua|wc -l` >= `ls ${PROJECT_DIR}/Data/Scripts/plist/*.plist|wc -l` ))\nthen\necho \"${PROJECT_DIR}/Data/Scripts/Multiplayer/Normal.plist:0: warning, missing plist implementation of a Multiplayer script file\"\nfi\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\""; + shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${PROJECT_DIR}/../AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n then\n mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\""; showEnvVarsInLog = 0; }; 9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = { diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Balanced Random Weapon.plist --- a/share/hedgewars/Data/Scripts/plist/Balanced Random Weapon.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Balanced_Random_Weapon.lua - description - - scheme - Default.plist - weapon - - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Capture the Flag.plist --- a/share/hedgewars/Data/Scripts/plist/Capture the Flag.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Capture_the_Flag.lua - description - - scheme - Default.plist - weapon - Default.plist - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Highlander.plist --- a/share/hedgewars/Data/Scripts/plist/Highlander.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Highlander.lua - description - - scheme - Default.plist - weapon - Default.plist - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/No Jumping.plist --- a/share/hedgewars/Data/Scripts/plist/No Jumping.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/No_Jumping.lua - description - - scheme - Default.plist - weapon - Default.plist - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Normal.plist --- a/share/hedgewars/Data/Scripts/plist/Normal.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - - description - - scheme - Default.plist - weapon - Default.plist - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Racer.plist --- a/share/hedgewars/Data/Scripts/plist/Racer.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Racer.lua - description - - scheme - Shoppa.plist - weapon - Shoppa.plist - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Random Weapon.plist --- a/share/hedgewars/Data/Scripts/plist/Random Weapon.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Balanced_Random_Weapon.lua - description - - scheme - Default.plist - weapon - - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Space Invasion.plist --- a/share/hedgewars/Data/Scripts/plist/Space Invasion.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Space_Invasion.lua - description - - scheme - Default.plist - weapon - Default.plist - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/The Specialists.plist --- a/share/hedgewars/Data/Scripts/plist/The Specialists.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/The_Specialists.lua - description - - scheme - - weapon - - - diff -r 268a2107d176 -r ed8bd253408c share/hedgewars/Data/Scripts/plist/Tumbler.plist --- a/share/hedgewars/Data/Scripts/plist/Tumbler.plist Wed Jun 13 23:28:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - command - escript Scripts/Multiplayer/Tumbler.lua - description - - scheme - Default.plist - weapon - Default.plist - -