Permalink
Browse files

fix linux compile problems

  • Loading branch information...
1 parent 4c7da80 commit aa5f406670c4a53e0204942754831a64b84d279a @core-code committed Nov 2, 2012
Showing with 10 additions and 4 deletions.
  1. +4 −4 Utilities/Core3D_Prefix.pch
  2. +6 −0 Utilities/Utilities.mm
@@ -5,9 +5,7 @@
#include <mach/mach_time.h>
#endif
-#ifdef __OBJC__
- #import <Foundation/Foundation.h>
-#endif
+
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE // iPhone
@@ -122,6 +120,9 @@
#define LOAD_NIB(x, o) [NSBundle loadNibNamed:x owner:o]
#else // Win / Linux
+ #define __STDC_LIMIT_MACROS 1
+ #include <stdint.h>
+
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
@@ -140,7 +141,6 @@
#include <stdio.h>
#include <stdlib.h>
- #include <stdint.h>
#include <stdarg.h>
#include <assert.h>
@@ -254,30 +254,36 @@ void UnloadSound(SOUND_TYPE soundID)
SOUND_TYPE LoadSound(NSString *name)
{
+#ifndef DISABLE_SOUND
if (!globalSettings.soundEnabled)
return NULL;
Mix_Chunk *chunk = Mix_LoadWAV([[[NSBundle mainBundle] pathForResource:name ofType:@"wav"] fileSystemRepresentation]);
if (!chunk)
NSLog(@"Error: could not LoadWAV named: %s", [name UTF8String]);
return chunk;
+#endif
}
void Play_Sound(SOUND_TYPE soundID)
{
+#ifndef DISABLE_SOUND
if (!globalSettings.soundEnabled || !soundID)
return;
int res = Mix_PlayChannel(-1, soundID, 0);
if (res == -1)
NSLog(@"Warning: could not play chunk %lx", (long)soundID);
+#endif
}
void UnloadSound(SOUND_TYPE soundID)
{
+#ifndef DISABLE_SOUND
if (globalSettings.soundEnabled && soundID)
Mix_FreeChunk(soundID);
+#endif
}
#else

0 comments on commit aa5f406

Please sign in to comment.