~swag/armagetronad/0.2.9-sty+ct+ap-fork

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*

*************************************************************************

ArmageTron -- Just another Tron Lightcycle Game in 3D.
Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)

**************************************************************************

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  
***************************************************************************

*/

#include "config.h"
#include <iostream>
#include <string.h>
#include <cstdlib>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "tError.h"
#include "tString.h"

#ifdef DEBUG
tLevel st_debugLevel[2]={static_cast<tLevel>(DEBUG),static_cast<tLevel>(DEBUG)};

int st_debugValid(tLevel l,tChannel c) {

    return st_debugLevel[c]>=static_cast<int>(l) ;}
#endif

void st_Breakpoint(){
#ifdef DEBUG
    std::cout << "Breakpoint!\n";
    int i=0; // a chance to get errors in GDB
    i++;
#endif
}

#ifndef WIN32

void st_PresentError( const char* caption, const char *message )
{
    std::cerr << caption << ": " << message << "\n";
    st_Breakpoint();
    static bool error = false; // to disable the error if it is inconvenient right now and you think it may not be fatal
    if ( error )
    {
        // throw 1; //tSimpleException( message, caption );
        exit(-1);
    }
}

void st_PresentMessage( const char* caption, const char *message )
{
    std::cerr << caption << ": " << message << "\n";
    st_Breakpoint();
}

#else

#include <windows.h>

void st_PresentError( const char* caption, const char *message )
{
    std::cerr << message;

#ifdef DEBUG	
    int result = MessageBox (NULL, message , caption, MB_RETRYCANCEL);
#else
int result = MessageBox (NULL, message , caption, MB_OK);
#endif
    switch ( result )
    {
    case IDRETRY:
    case IDYES:
        st_Breakpoint();
        break;
    case IDABORT:
    case IDOK:
    case IDCANCEL:
        throw 1;
        // exit(-1);
        break;
    }
}

void st_PresentMessage( const char* caption, const char *message )
{
    std::cerr << message;
    MessageBox (NULL, message , caption, MB_OK);
}

#endif // WINDOWS

char ERROR_MESSAGE[1000];