project_files/HedgewarsMobile/Classes/CommodityFunctions.m
changeset 4947 cfac6aab84a0
parent 4512 c6aff8ceada0
child 5201 7b9aa7aac336
equal deleted inserted replaced
4946:076767e86f2b 4947:cfac6aab84a0
    88 
    88 
    89     return modelId;
    89     return modelId;
    90 }
    90 }
    91 
    91 
    92 void playSound (NSString *snd) {
    92 void playSound (NSString *snd) {
    93     //Get the filename of the sound file:
    93     NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    94     NSString *path = [NSString stringWithFormat:@"%@/%@.wav",[[NSBundle mainBundle] resourcePath],snd];
    94     NSNumber *audio = [prefs objectForKey:@"audio"];
    95     
    95 
    96     //declare a system sound id
    96     if (audio == nil || [audio boolValue] == YES) {
    97     SystemSoundID soundID;
    97         // get the filename of the sound file:
    98 
    98         NSString *path = [NSString stringWithFormat:@"%@/%@.wav",[[NSBundle mainBundle] resourcePath],snd];
    99     //Get a URL for the sound file
    99 
   100     NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
   100         // declare a system sound id and get a URL for the sound file
   101 
   101         SystemSoundID soundID;
   102     //Use audio sevices to create the sound
   102         NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
   103     AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
   103 
   104 
   104         // use audio sevices to create and play the sound
   105     //Use audio services to play the sound
   105         AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
   106     AudioServicesPlaySystemSound(soundID);
   106         AudioServicesPlaySystemSound(soundID);
       
   107     }
   107 }
   108 }
   108 
   109 
   109 NSArray inline *getAvailableColors (void) {
   110 NSArray inline *getAvailableColors (void) {
   110     return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:0x3376E9],     // bluette
   111     return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:0x3376E9],     // bluette
   111                                      [NSNumber numberWithUnsignedInt:0x3e9321],     // greeeen
   112                                      [NSNumber numberWithUnsignedInt:0x3e9321],     // greeeen