author | celestar |
Mon, 15 Jan 2007 20:14:06 +0000 | |
branch | custombridgeheads |
changeset 5650 | aefc131bf5ce |
parent 5643 | 3778051e8095 |
child 6192 | c6adfc929c6b |
permissions | -rw-r--r-- |
2847
5c667829bc67
(svn r3395) Add Id tag (and svn property) to macosx files.
peter1138
parents:
2223
diff
changeset
|
1 |
/* $Id$ */ |
5c667829bc67
(svn r3395) Add Id tag (and svn property) to macosx files.
peter1138
parents:
2223
diff
changeset
|
2 |
|
2188
9acde6fcc645
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
3 |
#ifndef MACOS_H |
9acde6fcc645
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
4 |
#define MACOS_H |
9acde6fcc645
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
5 |
|
3127
c734d50ad134
(svn r3740) -Feature: [OSX] added OS version, CPU type and newGRF settings to assert window and a message to tell people to add that to a bug report
bjarni
parents:
2847
diff
changeset
|
6 |
/* |
c734d50ad134
(svn r3740) -Feature: [OSX] added OS version, CPU type and newGRF settings to assert window and a message to tell people to add that to a bug report
bjarni
parents:
2847
diff
changeset
|
7 |
* Functions to show the popup window |
c734d50ad134
(svn r3740) -Feature: [OSX] added OS version, CPU type and newGRF settings to assert window and a message to tell people to add that to a bug report
bjarni
parents:
2847
diff
changeset
|
8 |
* use ShowMacDialog when you want to control title, message and text on the button |
c734d50ad134
(svn r3740) -Feature: [OSX] added OS version, CPU type and newGRF settings to assert window and a message to tell people to add that to a bug report
bjarni
parents:
2847
diff
changeset
|
9 |
* ShowMacAssertDialog is used by assert |
c734d50ad134
(svn r3740) -Feature: [OSX] added OS version, CPU type and newGRF settings to assert window and a message to tell people to add that to a bug report
bjarni
parents:
2847
diff
changeset
|
10 |
* ShowMacErrorDialog should be used when an unrecoverable error shows up. It only contains the title, which will should tell what went wrong |
4434
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
3127
diff
changeset
|
11 |
* the function then adds text that tells the user to update and then report the bug if it's present in the newest version |
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
3127
diff
changeset
|
12 |
* It also quits in a nice way since we call it when we know something happened that will crash OpenTTD (like a needed pointer turns out to be NULL or similar) |
3127
c734d50ad134
(svn r3740) -Feature: [OSX] added OS version, CPU type and newGRF settings to assert window and a message to tell people to add that to a bug report
bjarni
parents:
2847
diff
changeset
|
13 |
*/ |
5650
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
14 |
#ifdef __cplusplus |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
15 |
extern "C" { |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
16 |
#endif //__cplusplus |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
17 |
void ShowMacDialog ( const char *title, const char *message, const char *buttonLabel ); |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
18 |
void ShowMacAssertDialog ( const char *function, const char *file, const int line, const char *expression ); |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
19 |
void ShowMacErrorDialog(const char *error); |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
20 |
#ifdef __cplusplus |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
21 |
} |
aefc131bf5ce
(svn r8149) [cbh] - Sync with -r8038:8038 from trunk (the cpp merge)
celestar
parents:
5643
diff
changeset
|
22 |
#endif //__cplusplus |
2188
9acde6fcc645
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
23 |
|
2223
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
24 |
// Since MacOS X users will never see an assert unless they started the game from a terminal |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
25 |
// we're using a custom assert(e) macro. |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
26 |
#undef assert |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
27 |
|
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
28 |
#ifdef NDEBUG |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
29 |
#define assert(e) ((void)0) |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
30 |
#else |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
31 |
|
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
32 |
#define assert(e) \ |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
33 |
(__builtin_expect(!(e), 0) ? ShowMacAssertDialog ( __func__, __FILE__, __LINE__, #e ): (void)0 ) |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
34 |
#endif |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
35 |
|
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
36 |
#endif /* MACOS_H */ |