8 |
|
#include "RenegadeConfig.h" |
9 |
|
|
10 |
|
#ifdef _WIN32 |
11 |
+ |
|
12 |
|
#include <io.h> |
13 |
|
#include <fcntl.h> |
14 |
|
#include "resource.h" |
15 |
+ |
|
16 |
|
#else |
17 |
< |
#include "gtk/gtk.h" |
17 |
> |
|
18 |
> |
#include "MapSelector.h" |
19 |
> |
|
20 |
|
#endif |
21 |
|
|
22 |
|
bool debug = false; |
24 |
|
RenegadeConfig* config; |
25 |
|
|
26 |
|
#ifndef _WIN32 |
27 |
+ |
|
28 |
|
inline string fix(const string& ansi) { return ansi; } |
29 |
|
inline void munge(void) { debug = true; } |
30 |
+ |
|
31 |
|
#else |
32 |
+ |
|
33 |
|
inline string fix(const wstring& wide) |
34 |
|
{ |
35 |
|
char* buffer = new char[wide.length() + 1]; |
72 |
|
|
73 |
|
debug = true; |
74 |
|
} |
75 |
+ |
|
76 |
|
#endif |
77 |
|
|
78 |
|
#ifdef _WIN32 |
84 |
|
int argc; |
85 |
|
unsigned short** argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
86 |
|
#else |
87 |
+ |
void selector(void); |
88 |
+ |
|
89 |
|
int main(int argc, char* argv[]) |
90 |
|
{ |
91 |
< |
gtk_init(&argc, &argv); |
91 |
> |
if (!gtk_init_check(&argc, &argv)) |
92 |
> |
{ |
93 |
> |
cerr << argv[0] << ": Cannot open display, need a clue-by-four?\n"; |
94 |
> |
|
95 |
> |
return 1; |
96 |
> |
} |
97 |
|
#endif |
98 |
|
|
99 |
|
string error; |
121 |
|
|
122 |
|
#ifdef _WIN32 |
123 |
|
MessageBox(NULL, error.c_str(), "Bad Arguments", MB_ICONERROR); |
124 |
+ |
#else |
125 |
+ |
message(NULL, error, "Bad Arguments", GTK_MESSAGE_ERROR); |
126 |
|
#endif |
127 |
|
return 1; |
128 |
|
} |
142 |
|
|
143 |
|
#ifdef _WIN32 |
144 |
|
MessageBox(NULL, error.c_str(), "Bad File", MB_ICONERROR); |
145 |
+ |
#else |
146 |
+ |
message(NULL, error, "Bad File", GTK_MESSAGE_ERROR); |
147 |
|
#endif |
148 |
|
return 1; |
149 |
|
} |
151 |
|
#ifdef _WIN32 |
152 |
|
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAP_SELECTOR), NULL, selector); |
153 |
|
#else |
154 |
< |
gtk_main(); |
154 |
> |
MapSelector selector; |
155 |
|
#endif |
156 |
|
|
157 |
|
delete config; |
168 |
|
} |
169 |
|
|
170 |
|
#ifdef _WIN32 |
171 |
+ |
|
172 |
|
int CALLBACK selector(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
173 |
|
{ |
174 |
|
switch (uMsg) |
473 |
|
|
474 |
|
return false; |
475 |
|
} |
476 |
+ |
|
477 |
|
#endif |