171 NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]]; |
171 NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]]; |
172 for (int i = 0; i < [mods count]; i++) |
172 for (int i = 0; i < [mods count]; i++) |
173 [gamemodArray addObject:[NSNumber numberWithBool:NO]]; |
173 [gamemodArray addObject:[NSNumber numberWithBool:NO]]; |
174 [mods release]; |
174 [mods release]; |
175 |
175 |
176 // workaround for randomorder that has to be set to YES |
176 switch (type) { |
177 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
177 case 0: // default |
|
178 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
179 break; |
|
180 case 1: // pro mode |
|
181 [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:15]]; |
|
182 [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; |
|
183 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
184 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
185 [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
186 break; |
|
187 case 2: // shoppa |
|
188 [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
189 [basicArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithInt:50]]; |
|
190 [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:1]]; |
|
191 [basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:0]]; |
|
192 [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:25]]; |
|
193 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
194 [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; |
|
195 [gamemodArray replaceObjectAtIndex:1 withObject:[NSNumber numberWithBool:YES]]; |
|
196 [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; |
|
197 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
198 [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
199 [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; |
|
200 [gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; |
|
201 break; |
|
202 case 3: // clean slate |
|
203 [gamemodArray replaceObjectAtIndex:6 withObject:[NSNumber numberWithBool:YES]]; |
|
204 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
205 [gamemodArray replaceObjectAtIndex:18 withObject:[NSNumber numberWithBool:YES]]; |
|
206 [gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; |
|
207 break; |
|
208 case 4: // minefield |
|
209 [basicArray replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:50]]; |
|
210 [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
211 [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; |
|
212 [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; |
|
213 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:80]]; |
|
214 [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; |
|
215 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
216 [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
217 [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; |
|
218 break; |
|
219 case 5: // barrel mayhem |
|
220 [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
221 [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; |
|
222 [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; |
|
223 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
224 [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:40]]; |
|
225 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
226 [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
227 break; |
|
228 case 6: // tunnel hogs |
|
229 [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; |
|
230 [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:3]]; |
|
231 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:10]]; |
|
232 [basicArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithInt:10]]; |
|
233 [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:10]]; |
|
234 [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; |
|
235 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
236 [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; |
|
237 [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; |
|
238 [gamemodArray replaceObjectAtIndex:16 withObject:[NSNumber numberWithBool:YES]]; |
|
239 break; |
|
240 case 7: // fort mode |
|
241 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; |
|
242 [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; |
|
243 [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; |
|
244 [gamemodArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithBool:YES]]; |
|
245 [gamemodArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithBool:YES]]; |
|
246 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
247 break; |
|
248 case 8: // timeless |
|
249 [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:100]]; |
|
250 [basicArray replaceObjectAtIndex:4 withObject:[NSNumber numberWithInt:0]]; |
|
251 [basicArray replaceObjectAtIndex:5 withObject:[NSNumber numberWithInt:0]]; |
|
252 [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:30]]; |
|
253 [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:5]]; |
|
254 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:3]]; |
|
255 [basicArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithInt:10]]; |
|
256 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
257 [gamemodArray replaceObjectAtIndex:20 withObject:[NSNumber numberWithBool:YES]]; |
|
258 break; |
|
259 case 9: // thinking with portals |
|
260 [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:2]]; |
|
261 [basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:25]]; |
|
262 [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:4]]; |
|
263 [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:5]]; |
|
264 [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:5]]; |
|
265 [gamemodArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithBool:YES]]; |
|
266 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
267 break; |
|
268 case 10:// king mode |
|
269 [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; |
|
270 [gamemodArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithBool:YES]]; |
|
271 break; |
|
272 default: |
|
273 DLog(@"Impossible"); |
|
274 break; |
|
275 } |
178 |
276 |
179 NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: |
277 NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: |
180 basicArray,@"basic", |
278 basicArray,@"basic", |
181 gamemodArray,@"gamemod", |
279 gamemodArray,@"gamemod", |
182 nil]; |
280 nil]; |
183 [gamemodArray release]; |
281 [gamemodArray release]; |
184 [basicArray release]; |
282 [basicArray release]; |
185 |
283 |
186 NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; |
284 NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; |
187 |
285 |
188 [theScheme writeToFile:schemeFile atomically:YES]; |
286 [theScheme writeToFile:schemeFile atomically:YES]; |
189 [schemeFile release]; |
287 [schemeFile release]; |
190 [theScheme release]; |
288 [theScheme release]; |