- Small refactoring for seed generation on iOS side
authorantonc27 <antonc27@mail.ru>
Wed, 17 Feb 2016 23:27:13 +0100
changeset 11559 73e6a3d2f768
parent 11558 5415e9d7436f
child 11560 b96080df19d0
- Small refactoring for seed generation on iOS side
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
project_files/HedgewarsMobile/Classes/HWUtils.h
project_files/HedgewarsMobile/Classes/HWUtils.m
project_files/HedgewarsMobile/Classes/MapConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Tue Feb 16 11:31:55 2016 -0500
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Wed Feb 17 23:27:13 2016 +0100
@@ -251,9 +251,7 @@
 
 +(void) startSimpleGame {
     // generate a seed
-    CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
-    NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
-    CFRelease(uuid);
+    NSString *seed = [HWUtils seed];
     NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
     [seed release];
 
--- a/project_files/HedgewarsMobile/Classes/HWUtils.h	Tue Feb 16 11:31:55 2016 -0500
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.h	Wed Feb 17 23:27:13 2016 +0100
@@ -43,6 +43,7 @@
 +(BOOL) isNetworkReachable;
 +(NSString *) languageID;
 //+(UIView *)mainSDLViewInstance;
++(NSString *) seed;
 
 @end
 
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m	Tue Feb 16 11:31:55 2016 -0500
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m	Wed Feb 17 23:27:13 2016 +0100
@@ -174,4 +174,12 @@
 }
 */
 
++ (NSString *)seed
+{
+    CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
+    NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
+    CFRelease(uuid);
+    return seed;
+}
+
 @end
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Tue Feb 16 11:31:55 2016 -0500
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Wed Feb 17 23:27:13 2016 +0100
@@ -45,9 +45,7 @@
         return;
 
     // generate a seed
-    CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
-    NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
-    CFRelease(uuid);
+    NSString *seed = [HWUtils seed];
     NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
     self.seedCommand = seedCmd;
     [seedCmd release];