project_files/HedgewarsMobile/Classes/CommodityFunctions.m
changeset 3697 d5b30d6373fc
parent 3670 4c673e57f0d7
child 3737 2ba6ac8a114b
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Sat Jul 31 10:52:43 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Sat Jul 31 11:24:53 2010 +0200
@@ -14,16 +14,16 @@
 
 void createTeamNamed (NSString *nameWithoutExt) {
     NSString *teamsDirectory = TEAMS_DIRECTORY();
-    
+
     if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) {
-        [[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory 
-                                  withIntermediateDirectories:NO 
-                                                   attributes:nil 
+        [[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory
+                                  withIntermediateDirectories:NO
+                                                   attributes:nil
                                                         error:NULL];
     }
-    
+
     NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: MAX_HOGS];
-    
+
     for (int i = 0; i < MAX_HOGS; i++) {
         NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i];
         NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:0],@"level",
@@ -32,12 +32,12 @@
         [hedgehogs addObject:hog];
         [hog release];
     }
-    
+
     NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"0",@"hash",
                              @"Statue",@"grave", @"Plane",@"fort", @"Default",@"voicepack",
                              @"hedgewars",@"flag", hedgehogs,@"hedgehogs", nil];
     [hedgehogs release];
-    
+
     NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt];
 
     [theTeam writeToFile:teamFile atomically:YES];
@@ -49,21 +49,21 @@
     NSString *weaponsDirectory = WEAPONS_DIRECTORY();
 
     if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) {
-        [[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory 
-                                  withIntermediateDirectories:NO 
-                                                   attributes:nil 
+        [[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory
+                                  withIntermediateDirectories:NO
+                                                   attributes:nil
                                                         error:NULL];
     }
-    
+
     NSDictionary *theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
                                [NSNumber numberWithInt:CURRENT_AMMOSIZE],@"version",
                                @"9391929422199121032235111001201000000211110111",@"ammostore_initialqt",
                                @"0405040541600655546554464776576666666155510111",@"ammostore_probability",
                                @"0000000000000205500000040007004000000000200000",@"ammostore_delay",
                                @"1311110312111111123114111111111111111211111111",@"ammostore_crate", nil];
-    
+
     NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt];
-    
+
     [theWeapon writeToFile:weaponFile atomically:YES];
     [weaponFile release];
     [theWeapon release];
@@ -71,14 +71,14 @@
 
 void createSchemeNamed (NSString *nameWithoutExt) {
     NSString *schemesDirectory = SCHEMES_DIRECTORY();
-    
+
     if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
-        [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory 
-                                  withIntermediateDirectories:NO 
-                                                   attributes:nil 
+        [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory
+                                  withIntermediateDirectories:NO
+                                                   attributes:nil
                                                         error:NULL];
     }
-    
+
     NSArray *theScheme = [[NSArray alloc] initWithObjects:
                           [NSNumber numberWithBool:NO],    //fortmode
                           [NSNumber numberWithBool:NO],    //divideteam
@@ -107,7 +107,7 @@
                           [NSNumber numberWithInt:0],      //dudmines
                           [NSNumber numberWithInt:2],      //explosives
                           nil];
-    
+
     NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt];
 
     [theScheme writeToFile:schemeFile atomically:YES];
@@ -117,7 +117,7 @@
 
 BOOL rotationManager (UIInterfaceOrientation interfaceOrientation) {
     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) ||
-           (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);  
+           (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
 }
 
 NSInteger randomPort () {
@@ -140,17 +140,17 @@
     mach_port_t host_port;
     mach_msg_type_number_t host_size;
     vm_size_t pagesize;
-    
+
     host_port = mach_host_self();
     host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
-    host_page_size(host_port, &pagesize);        
- 
+    host_page_size(host_port, &pagesize);
+
     vm_statistics_data_t vm_stat;
-              
+
     if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS)
         DLog(@"Failed to fetch vm statistics");
- 
-    /* Stats in bytes */ 
+
+    /* Stats in bytes */
     natural_t mem_used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pagesize;
     natural_t mem_free = vm_stat.free_count * pagesize;
     natural_t mem_total = mem_used + mem_free;
@@ -164,12 +164,12 @@
 NSString *modelType () {
     size_t size;
     // set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space
-    sysctlbyname("hw.machine", NULL, &size, NULL, 0); 
+    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
     char *name = (char *)malloc(sizeof(char) * size);
     // get the platform name
     sysctlbyname("hw.machine", name, &size, NULL, 0);
     NSString *modelId = [NSString stringWithUTF8String:name];
     free(name);
-    
+
     return modelId;
-}
\ No newline at end of file
+}