project_files/HedgewarsMobile/Classes/HWUtils.m
changeset 6247 6dfad55fd71c
parent 6246 6b2d19ed521a
child 6262 32a032f1b178
equal deleted inserted replaced
6246:6b2d19ed521a 6247:6dfad55fd71c
    27 #import "hwconsts.h"
    27 #import "hwconsts.h"
    28 
    28 
    29 static NSString *cachedModel = nil;
    29 static NSString *cachedModel = nil;
    30 static NSArray *cachedColors = nil;
    30 static NSArray *cachedColors = nil;
    31 
    31 
       
    32 static TGameType gameType = gtNone;
       
    33 static TGameStatus gameStatus = gsNone;
       
    34 
    32 @implementation HWUtils
    35 @implementation HWUtils
    33 
    36 
       
    37 #pragma mark -
       
    38 #pragma mark game status and type info
       
    39 +(TGameType) gameType {
       
    40     return gameType;
       
    41 }
       
    42 
       
    43 +(void) setGameType:(TGameType) type {
       
    44     gameType = type;
       
    45 }
       
    46 
       
    47 +(TGameStatus) gameStatus {
       
    48     return gameStatus;
       
    49 }
       
    50 
       
    51 +(void) setGameStatus:(TGameStatus) status {
       
    52     gameStatus = status;
       
    53 }
       
    54 
       
    55 +(BOOL) isGameLaunched {
       
    56     return ((gameStatus == gsLoading) || (gameStatus == gsInGame));
       
    57 }
       
    58 
       
    59 +(BOOL) isGameRunning {
       
    60     return (gameStatus == gsInGame);
       
    61 }
       
    62 
       
    63 #pragma mark -
       
    64 #pragma mark Helper Functions
    34 +(NSString *)modelType {
    65 +(NSString *)modelType {
    35     if (cachedModel == nil) {
    66     if (cachedModel == nil) {
    36         size_t size;
    67         size_t size;
    37         // set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space
    68         // set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space
    38         sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    69         sysctlbyname("hw.machine", NULL, &size, NULL, 0);