3325
|
1 |
//
|
|
2 |
// CommodityFunctions.m
|
|
3 |
// HedgewarsMobile
|
|
4 |
//
|
|
5 |
// Created by Vittorio on 08/04/10.
|
|
6 |
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
|
7 |
//
|
|
8 |
|
|
9 |
#import "CommodityFunctions.h"
|
3335
|
10 |
#import "SDL_uikitappdelegate.h"
|
3325
|
11 |
|
|
12 |
void createTeamNamed (NSString *nameWithoutExt) {
|
|
13 |
NSString *teamsDirectory = TEAMS_DIRECTORY();
|
|
14 |
|
|
15 |
if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) {
|
|
16 |
[[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory
|
|
17 |
withIntermediateDirectories:NO
|
|
18 |
attributes:nil
|
|
19 |
error:NULL];
|
|
20 |
}
|
|
21 |
|
|
22 |
NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: MAX_HOGS];
|
|
23 |
|
|
24 |
for (int i = 0; i < MAX_HOGS; i++) {
|
|
25 |
NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i];
|
3339
|
26 |
NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health", [NSNumber numberWithInt:0],@"level",
|
3325
|
27 |
hogName,@"hogname", @"NoHat",@"hat", nil];
|
|
28 |
[hogName release];
|
|
29 |
[hedgehogs addObject:hog];
|
|
30 |
[hog release];
|
|
31 |
}
|
|
32 |
|
|
33 |
NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"0",@"hash", nameWithoutExt,@"teamname",
|
|
34 |
@"Statue",@"grave", @"Plane",@"fort", @"Default",@"voicepack",
|
|
35 |
@"hedgewars",@"flag", hedgehogs,@"hedgehogs", nil];
|
|
36 |
[hedgehogs release];
|
|
37 |
|
|
38 |
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt];
|
3352
|
39 |
|
3325
|
40 |
[theTeam writeToFile:teamFile atomically:YES];
|
|
41 |
[teamFile release];
|
|
42 |
[theTeam release];
|
|
43 |
}
|
3330
|
44 |
|
3335
|
45 |
BOOL rotationManager (UIInterfaceOrientation interfaceOrientation) {
|
|
46 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
|
|
47 |
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
|
|
48 |
else
|
|
49 |
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
|
|
50 |
|
|
51 |
}
|