author | koda |
Sat, 08 Oct 2011 21:17:24 +0200 | |
changeset 6103 | 55ecfbf834e3 |
parent 5984 | 6fd40d866342 |
child 6104 | 117bdf4e7af9 |
permissions | -rw-r--r-- |
4281 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
4976 | 3 |
* Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com> |
4281 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
17 |
* |
|
18 |
* File created on 12/11/2010. |
|
19 |
*/ |
|
20 |
||
21 |
||
22 |
#import "CreationChamber.h" |
|
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
23 |
#import "hwconsts.h" |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
24 |
|
6103 | 25 |
|
26 |
@implementation CreationChamber |
|
27 |
||
28 |
#pragma mark Settings |
|
29 |
+(void) createSettings { |
|
5206 | 30 |
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; |
31 |
[settings setObject:[NSNumber numberWithBool:NO] forKey:@"alternate"]; |
|
32 |
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"]; |
|
33 |
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"sound"]; |
|
34 |
[settings setObject:[NSNumber numberWithBool:NO] forKey:@"classic_menu"]; |
|
5451
e359a79e3d08
rip out the sync weapons/schemes switch and place it into settings; also perform some runtime check on what can be enabled
koda
parents:
5376
diff
changeset
|
35 |
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"sync_ws"]; |
e359a79e3d08
rip out the sync weapons/schemes switch and place it into settings; also perform some runtime check on what can be enabled
koda
parents:
5376
diff
changeset
|
36 |
|
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
5206
diff
changeset
|
37 |
// don't overwrite these two strings when present |
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
5206
diff
changeset
|
38 |
if ([settings objectForKey:@"username"] == nil) |
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
5206
diff
changeset
|
39 |
[settings setObject:@"" forKey:@"username"]; |
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
5206
diff
changeset
|
40 |
if ([settings objectForKey:@"password"] == nil) |
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
5206
diff
changeset
|
41 |
[settings setObject:@"" forKey:@"password"]; |
5206 | 42 |
|
43 |
[settings synchronize]; |
|
44 |
} |
|
4281 | 45 |
|
6103 | 46 |
#pragma mark Teams |
47 |
+(void) createTeamNamed:(NSString *)nameWithoutExt { |
|
48 |
[CreationChamber createTeamNamed:nameWithoutExt ofType:0 controlledByAI:NO]; |
|
49 |
} |
|
50 |
||
51 |
+(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type { |
|
52 |
[CreationChamber createTeamNamed:nameWithoutExt ofType:type controlledByAI:NO]; |
|
53 |
} |
|
54 |
||
55 |
+(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type controlledByAI:(BOOL) flag { |
|
4281 | 56 |
NSString *teamsDirectory = TEAMS_DIRECTORY(); |
57 |
||
58 |
if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) { |
|
59 |
[[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory |
|
60 |
withIntermediateDirectories:NO |
|
61 |
attributes:nil |
|
62 |
error:NULL]; |
|
63 |
} |
|
64 |
||
65 |
NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: HW_getMaxNumberOfHogs()]; |
|
66 |
||
67 |
for (int i = 0; i < HW_getMaxNumberOfHogs(); i++) { |
|
68 |
NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i]; |
|
69 |
NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
70 |
[NSNumber numberWithInt:0],@"level", |
|
71 |
hogName,@"hogname", |
|
72 |
@"NoHat",@"hat", |
|
73 |
nil]; |
|
74 |
[hogName release]; |
|
75 |
[hedgehogs addObject:hog]; |
|
76 |
[hog release]; |
|
77 |
} |
|
78 |
||
79 |
NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
80 |
@"0",@"hash", |
|
81 |
@"Statue",@"grave", |
|
82 |
@"Plane",@"fort", |
|
83 |
@"Default",@"voicepack", |
|
84 |
@"hedgewars",@"flag", |
|
85 |
hedgehogs,@"hedgehogs", |
|
86 |
nil]; |
|
87 |
[hedgehogs release]; |
|
88 |
||
89 |
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt]; |
|
90 |
||
91 |
[theTeam writeToFile:teamFile atomically:YES]; |
|
92 |
[teamFile release]; |
|
93 |
[theTeam release]; |
|
94 |
} |
|
95 |
||
6103 | 96 |
#pragma mark Weapons |
97 |
+(void) createWeaponNamed:(NSString *)nameWithoutExt { |
|
98 |
[CreationChamber createWeaponNamed:nameWithoutExt ofType:0]; |
|
99 |
} |
|
100 |
||
101 |
+(void) createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type { |
|
4281 | 102 |
NSString *weaponsDirectory = WEAPONS_DIRECTORY(); |
103 |
||
104 |
if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) { |
|
105 |
[[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory |
|
106 |
withIntermediateDirectories:NO |
|
107 |
attributes:nil |
|
108 |
error:NULL]; |
|
109 |
} |
|
110 |
||
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
111 |
NSInteger ammolineSize = HW_getNumberOfWeapons(); |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
112 |
NSString *qt, *prob, *delay, *crate; |
4281 | 113 |
switch (type) { |
4607 | 114 |
default: //default |
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
115 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
5376 | 116 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
117 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
|
118 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
|
4281 | 119 |
break; |
120 |
case 1: //crazy |
|
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
121 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
122 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
123 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
124 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
4281 | 125 |
break; |
126 |
case 2: //pro mode |
|
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
127 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
128 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
129 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
130 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
4281 | 131 |
break; |
132 |
case 3: //shoppa |
|
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
133 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
134 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
135 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
136 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
4281 | 137 |
break; |
138 |
case 4: //clean slate |
|
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
139 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
140 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
141 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
142 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
4281 | 143 |
break; |
144 |
case 5: //minefield |
|
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
145 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_MINES_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
146 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_MINES_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
147 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_MINES_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
148 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_MINES_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
149 |
break; |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
150 |
case 6: //thinking with portals |
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
151 |
qt = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_QT length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
152 |
prob = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
153 |
delay = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
154 |
crate = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; |
4281 | 155 |
break; |
156 |
} |
|
157 |
||
5200
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
158 |
NSDictionary *theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: qt,@"ammostore_initialqt", |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
159 |
prob,@"ammostore_probability", delay,@"ammostore_delay", crate,@"ammostore_crate", nil]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
160 |
[qt release]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
161 |
[prob release]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
162 |
[delay release]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
163 |
[crate release]; |
7440fe992e73
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents:
5185
diff
changeset
|
164 |
|
4281 | 165 |
NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt]; |
166 |
[theWeapon writeToFile:weaponFile atomically:YES]; |
|
167 |
[weaponFile release]; |
|
168 |
[theWeapon release]; |
|
169 |
} |
|
170 |
||
6103 | 171 |
#pragma mark Schemes |
172 |
+(void) createSchemeNamed:(NSString *)nameWithoutExt { |
|
173 |
[CreationChamber createSchemeNamed:nameWithoutExt ofType:0]; |
|
174 |
} |
|
175 |
||
176 |
+(void) createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type { |
|
4281 | 177 |
NSString *schemesDirectory = SCHEMES_DIRECTORY(); |
178 |
||
179 |
if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { |
|
180 |
[[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory |
|
181 |
withIntermediateDirectories:NO |
|
182 |
attributes:nil |
|
183 |
error:NULL]; |
|
184 |
} |
|
185 |
||
5181 | 186 |
// load data to get the size of the arrays and their default values |
5185
7607a64e1853
remove the trailing _en from scheme data and use the macros available instead of creating a string every time
koda
parents:
5181
diff
changeset
|
187 |
NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:BASICFLAGS_FILE()]; |
5181 | 188 |
NSMutableArray *basicArray = [[NSMutableArray alloc] initWithCapacity:[basicSettings count]]; |
189 |
for (NSDictionary *basicDict in basicSettings) |
|
190 |
[basicArray addObject:[basicDict objectForKey:@"default"]]; |
|
191 |
[basicSettings release]; |
|
4281 | 192 |
|
5185
7607a64e1853
remove the trailing _en from scheme data and use the macros available instead of creating a string every time
koda
parents:
5181
diff
changeset
|
193 |
NSArray *mods = [[NSArray alloc] initWithContentsOfFile:GAMEMODS_FILE()]; |
5181 | 194 |
NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]]; |
195 |
for (int i = 0; i < [mods count]; i++) |
|
196 |
[gamemodArray addObject:[NSNumber numberWithBool:NO]]; |
|
197 |
[mods release]; |
|
198 |
||
5984 | 199 |
switch (type) { |
200 |
case 0: // default |
|
201 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
202 |
break; |
|
203 |
case 1: // pro mode |
|
204 |
[basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:15]]; |
|
205 |
[basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; |
|
206 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
207 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
208 |
[gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
209 |
break; |
|
210 |
case 2: // shoppa |
|
211 |
[basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
212 |
[basicArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithInt:50]]; |
|
213 |
[basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:1]]; |
|
214 |
[basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:0]]; |
|
215 |
[basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:25]]; |
|
216 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
217 |
[basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; |
|
218 |
[gamemodArray replaceObjectAtIndex:1 withObject:[NSNumber numberWithBool:YES]]; |
|
219 |
[gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; |
|
220 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
221 |
[gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
222 |
[gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; |
|
223 |
[gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; |
|
224 |
break; |
|
225 |
case 3: // clean slate |
|
226 |
[gamemodArray replaceObjectAtIndex:6 withObject:[NSNumber numberWithBool:YES]]; |
|
227 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
228 |
[gamemodArray replaceObjectAtIndex:18 withObject:[NSNumber numberWithBool:YES]]; |
|
229 |
[gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; |
|
230 |
break; |
|
231 |
case 4: // minefield |
|
232 |
[basicArray replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:50]]; |
|
233 |
[basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
234 |
[basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; |
|
235 |
[basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; |
|
236 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:80]]; |
|
237 |
[basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; |
|
238 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
239 |
[gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
240 |
[gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; |
|
241 |
break; |
|
242 |
case 5: // barrel mayhem |
|
243 |
[basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
244 |
[basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; |
|
245 |
[basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; |
|
246 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
247 |
[basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:40]]; |
|
248 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
249 |
[gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
250 |
break; |
|
251 |
case 6: // tunnel hogs |
|
252 |
[basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
253 |
[basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:3]]; |
|
254 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:10]]; |
|
255 |
[basicArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithInt:10]]; |
|
256 |
[basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:10]]; |
|
257 |
[gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; |
|
258 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
259 |
[gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
260 |
[gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; |
|
261 |
[gamemodArray replaceObjectAtIndex:16 withObject:[NSNumber numberWithBool:YES]]; |
|
262 |
break; |
|
263 |
case 7: // fort mode |
|
264 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
265 |
[basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; |
|
266 |
[gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; |
|
267 |
[gamemodArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithBool:YES]]; |
|
268 |
[gamemodArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithBool:YES]]; |
|
269 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
270 |
break; |
|
271 |
case 8: // timeless |
|
272 |
[basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:100]]; |
|
273 |
[basicArray replaceObjectAtIndex:4 withObject:[NSNumber numberWithInt:0]]; |
|
274 |
[basicArray replaceObjectAtIndex:5 withObject:[NSNumber numberWithInt:0]]; |
|
275 |
[basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:30]]; |
|
276 |
[basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:5]]; |
|
277 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:3]]; |
|
278 |
[basicArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithInt:10]]; |
|
279 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
280 |
[gamemodArray replaceObjectAtIndex:20 withObject:[NSNumber numberWithBool:YES]]; |
|
281 |
break; |
|
282 |
case 9: // thinking with portals |
|
283 |
[basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:2]]; |
|
284 |
[basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:25]]; |
|
285 |
[basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:4]]; |
|
286 |
[basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:5]]; |
|
287 |
[basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:5]]; |
|
288 |
[gamemodArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithBool:YES]]; |
|
289 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
290 |
break; |
|
291 |
case 10:// king mode |
|
292 |
[gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
293 |
[gamemodArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithBool:YES]]; |
|
294 |
break; |
|
295 |
default: |
|
296 |
DLog(@"Impossible"); |
|
297 |
break; |
|
298 |
} |
|
5181 | 299 |
|
4281 | 300 |
NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: |
301 |
basicArray,@"basic", |
|
302 |
gamemodArray,@"gamemod", |
|
303 |
nil]; |
|
304 |
[gamemodArray release]; |
|
305 |
[basicArray release]; |
|
5984 | 306 |
|
4281 | 307 |
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; |
308 |
||
309 |
[theScheme writeToFile:schemeFile atomically:YES]; |
|
310 |
[schemeFile release]; |
|
311 |
[theScheme release]; |
|
312 |
} |
|
6103 | 313 |
|
314 |
@end |