summaryrefslogtreecommitdiff
path: root/src/os/macosx/macos.h
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2009-10-04 20:53:30 +0000
committermichi_cc <michi_cc@openttd.org>2009-10-04 20:53:30 +0000
commite2ef24919e8f9dbefa06161d5b6fe5cbc6eb7bd5 (patch)
tree9bfa7dbe264e1a4f6633a6c7d44b8b25a8446aab /src/os/macosx/macos.h
parent48106b817aa83b9b265e52c3379cc416ca09b2bb (diff)
downloadopenttd-e2ef24919e8f9dbefa06161d5b6fe5cbc6eb7bd5.tar.xz
(svn r17704) -Codechange: [OSX] Improve detection of OS X version. (planetmaker)
Diffstat (limited to 'src/os/macosx/macos.h')
-rw-r--r--src/os/macosx/macos.h31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/os/macosx/macos.h b/src/os/macosx/macos.h
index 247f4427d..7783257bc 100644
--- a/src/os/macosx/macos.h
+++ b/src/os/macosx/macos.h
@@ -54,25 +54,7 @@ void ShowMacErrorDialog(const char *error);
(__builtin_expect(!(e), 0) ? ShowMacAssertDialog ( __func__, __FILE__, __LINE__, #e ): (void)0 )
#endif
-
-
-/**
- * Get the major version of Mac OS we are running under. Useful for things like the cocoa driver.
- * @return major version of the os. This would be 10 in the case of 10.4.11.
- */
-long GetMacOSVersionMajor();
-
-/**
- * Get the minor version of Mac OS we are running under. Useful for things like the cocoa driver.
- * @return minor version of the os. This would be 4 in the case of 10.4.11.
- */
-long GetMacOSVersionMinor();
-
-/**
- * Get the bugfix version of Mac OS we are running under. Useful for things like the cocoa driver.
- * @return bugfix version of the os. This would be 11 in the case of 10.4.11.
- */
-long GetMacOSVersionBugfix();
+void GetMacOSVersion(int *return_major, int *return_minor, int *return_bugfix);
/**
* Check if we are at least running on the specified version of Mac OS.
@@ -83,13 +65,12 @@ long GetMacOSVersionBugfix();
*/
static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
{
- long maj = GetMacOSVersionMajor();
- long min = GetMacOSVersionMinor();
- long bf = GetMacOSVersionBugfix();
+ int version_major, version_minor, version_bugfix;
+ GetMacOSVersion(&version_major, &version_minor, &version_bugfix);
- if (maj < major) return false;
- if (maj == major && min < minor) return false;
- if (maj == major && min == minor && bf < bugfix) return false;
+ if (version_major < major) return false;
+ if (version_major == major && version_minor < minor) return false;
+ if (version_major == major && version_minor == minor && version_bugfix < bugfix) return false;
return true;
}