|
Lines 1-5
Link Here
|
| 1 |
--- src/GTK/GtkInterface.C Wed May 12 21:43:29 1999 |
1 |
--- src/GTK/GtkInterface.C.orig 1999-05-12 11:43:29 UTC |
| 2 |
+++ src/GTK/GtkInterface.C Sat Oct 26 00:36:57 2002 |
2 |
+++ src/GTK/GtkInterface.C |
| 3 |
@@ -37,7 +37,7 @@ |
3 |
@@ -37,7 +37,7 @@ |
| 4 |
#include <gtk/gtk.h> |
4 |
#include <gtk/gtk.h> |
| 5 |
#include <gdk/gdkkeysyms.h> |
5 |
#include <gdk/gdkkeysyms.h> |
|
Lines 9-15
Link Here
|
| 9 |
|
9 |
|
| 10 |
#include <unistd.h> |
10 |
#include <unistd.h> |
| 11 |
#include <stdlib.h> |
11 |
#include <stdlib.h> |
| 12 |
@@ -138,7 +138,7 @@ |
12 |
@@ -138,7 +138,7 @@ void GtkInterface::init(int argc, char * |
| 13 |
display_version(); |
13 |
display_version(); |
| 14 |
|
14 |
|
| 15 |
if (_two_key) |
15 |
if (_two_key) |
|
Lines 18-24
Link Here
|
| 18 |
|
18 |
|
| 19 |
|
19 |
|
| 20 |
// connect pipe_handler to SIGPIPE signal |
20 |
// connect pipe_handler to SIGPIPE signal |
| 21 |
@@ -154,9 +154,9 @@ |
21 |
@@ -154,9 +154,9 @@ void GtkInterface::init(int argc, char * |
| 22 |
exit(2); |
22 |
exit(2); |
| 23 |
} |
23 |
} |
| 24 |
|
24 |
|
|
Lines 30-36
Link Here
|
| 30 |
|
30 |
|
| 31 |
// create and bind socket to any port |
31 |
// create and bind socket to any port |
| 32 |
port = 0; |
32 |
port = 0; |
| 33 |
@@ -168,8 +168,8 @@ |
33 |
@@ -168,8 +168,8 @@ void GtkInterface::init(int argc, char * |
| 34 |
} |
34 |
} |
| 35 |
|
35 |
|
| 36 |
if (_debug) |
36 |
if (_debug) |
|
Lines 41-47
Link Here
|
| 41 |
|
41 |
|
| 42 |
// Build server address |
42 |
// Build server address |
| 43 |
server_address.sin_family = AF_INET; |
43 |
server_address.sin_family = AF_INET; |
| 44 |
@@ -186,7 +186,7 @@ |
44 |
@@ -186,7 +186,7 @@ void GtkInterface::init(int argc, char * |
| 45 |
|
45 |
|
| 46 |
display_play_help(); |
46 |
display_play_help(); |
| 47 |
|
47 |
|
|
Lines 50-56
Link Here
|
| 50 |
|
50 |
|
| 51 |
_hack_socket_client = _socket_client; // hack for signal handling |
51 |
_hack_socket_client = _socket_client; // hack for signal handling |
| 52 |
action.sa_handler = stop_handler; |
52 |
action.sa_handler = stop_handler; |
| 53 |
@@ -196,7 +196,7 @@ |
53 |
@@ -196,7 +196,7 @@ void GtkInterface::init(int argc, char * |
| 54 |
|
54 |
|
| 55 |
init_messages(options.get_message_file()); |
55 |
init_messages(options.get_message_file()); |
| 56 |
|
56 |
|
|
Lines 59-65
Link Here
|
| 59 |
make(argc, argv); |
59 |
make(argc, argv); |
| 60 |
} |
60 |
} |
| 61 |
|
61 |
|
| 62 |
@@ -294,7 +294,7 @@ |
62 |
@@ -294,7 +294,7 @@ gint GtkInterface::key_cb(GtkWidget *wid |
| 63 |
case 'z': |
63 |
case 'z': |
| 64 |
{ |
64 |
{ |
| 65 |
// if (_debug) |
65 |
// if (_debug) |
|
Lines 68-74
Link Here
|
| 68 |
|
68 |
|
| 69 |
Trame tzz; |
69 |
Trame tzz; |
| 70 |
tzz.reset(); |
70 |
tzz.reset(); |
| 71 |
@@ -315,7 +315,7 @@ |
71 |
@@ -315,7 +315,7 @@ gint GtkInterface::key_cb(GtkWidget *wid |
| 72 |
|
72 |
|
| 73 |
default: |
73 |
default: |
| 74 |
if (mythis._debug) |
74 |
if (mythis._debug) |
|
Lines 77-83
Link Here
|
| 77 |
return FALSE; |
77 |
return FALSE; |
| 78 |
} |
78 |
} |
| 79 |
|
79 |
|
| 80 |
@@ -337,7 +337,7 @@ |
80 |
@@ -337,7 +337,7 @@ gint GtkInterface::configure_event (GtkW |
| 81 |
GtkInterface *pthis) |
81 |
GtkInterface *pthis) |
| 82 |
{ |
82 |
{ |
| 83 |
if (pthis->_debug) |
83 |
if (pthis->_debug) |
|
Lines 86-92
Link Here
|
| 86 |
|
86 |
|
| 87 |
return FALSE; |
87 |
return FALSE; |
| 88 |
} |
88 |
} |
| 89 |
@@ -349,7 +349,7 @@ |
89 |
@@ -349,7 +349,7 @@ gint GtkInterface::expose_event (GtkWidg |
| 90 |
GtkInterface *pthis) |
90 |
GtkInterface *pthis) |
| 91 |
{ |
91 |
{ |
| 92 |
if (pthis->_debug) |
92 |
if (pthis->_debug) |
|
Lines 95-101
Link Here
|
| 95 |
|
95 |
|
| 96 |
return FALSE; |
96 |
return FALSE; |
| 97 |
} |
97 |
} |
| 98 |
@@ -476,7 +476,7 @@ |
98 |
@@ -476,7 +476,7 @@ void GtkInterface::make(int argc, char * |
| 99 |
// GTK, the proper way to do this would be to use the |
99 |
// GTK, the proper way to do this would be to use the |
| 100 |
// gdk_input_add() function. |
100 |
// gdk_input_add() function. |
| 101 |
|
101 |
|
|
Lines 104-110
Link Here
|
| 104 |
|
104 |
|
| 105 |
gdk_input_add(_socket_client, |
105 |
gdk_input_add(_socket_client, |
| 106 |
GDK_INPUT_READ, |
106 |
GDK_INPUT_READ, |
| 107 |
@@ -487,57 +487,57 @@ |
107 |
@@ -487,57 +487,57 @@ void GtkInterface::make(int argc, char * |
| 108 |
// display version numbers (long format) |
108 |
// display version numbers (long format) |
| 109 |
void GtkInterface::display_version() |
109 |
void GtkInterface::display_version() |
| 110 |
{ |
110 |
{ |
|
Lines 196-202
Link Here
|
| 196 |
} |
196 |
} |
| 197 |
|
197 |
|
| 198 |
|
198 |
|
| 199 |
@@ -547,7 +547,7 @@ |
199 |
@@ -547,7 +547,7 @@ void GtkInterface::display_play_help() |
| 200 |
|
200 |
|
| 201 |
void GtkInterface::pipe_handler(int sig) |
201 |
void GtkInterface::pipe_handler(int sig) |
| 202 |
{ |
202 |
{ |
|
Lines 205-211
Link Here
|
| 205 |
sig++; // warnings.. |
205 |
sig++; // warnings.. |
| 206 |
_dead_server = 1; |
206 |
_dead_server = 1; |
| 207 |
} |
207 |
} |
| 208 |
@@ -555,7 +555,7 @@ |
208 |
@@ -555,7 +555,7 @@ void GtkInterface::pipe_handler(int sig) |
| 209 |
|
209 |
|
| 210 |
void GtkInterface::stop_handler(int sig) |
210 |
void GtkInterface::stop_handler(int sig) |
| 211 |
{ |
211 |
{ |
|
Lines 214-220
Link Here
|
| 214 |
|
214 |
|
| 215 |
if (_hack_socket_client) { |
215 |
if (_hack_socket_client) { |
| 216 |
struct timeval tv; |
216 |
struct timeval tv; |
| 217 |
@@ -647,11 +647,11 @@ |
217 |
@@ -647,11 +647,11 @@ void GtkInterface::display_message(Playe |
| 218 |
char buf[300]; |
218 |
char buf[300]; |
| 219 |
|
219 |
|
| 220 |
if (priv) { |
220 |
if (priv) { |
|
Lines 228-234
Link Here
|
| 228 |
sprintf(buf, "%s> %s\n", from.get_name(), msg); |
228 |
sprintf(buf, "%s> %s\n", from.get_name(), msg); |
| 229 |
} |
229 |
} |
| 230 |
|
230 |
|
| 231 |
@@ -707,7 +707,7 @@ |
231 |
@@ -707,7 +707,7 @@ void GtkInterface::run(void) |
| 232 |
void GtkInterface::join_game() |
232 |
void GtkInterface::join_game() |
| 233 |
{ |
233 |
{ |
| 234 |
if (_debug) |
234 |
if (_debug) |
|
Lines 237-243
Link Here
|
| 237 |
|
237 |
|
| 238 |
t.put_char(JOIN_GAME); |
238 |
t.put_char(JOIN_GAME); |
| 239 |
t.put_string(_own_name); |
239 |
t.put_string(_own_name); |
| 240 |
@@ -740,21 +740,21 @@ |
240 |
@@ -740,21 +740,21 @@ void GtkInterface::handle_server_input_s |
| 241 |
gint source, |
241 |
gint source, |
| 242 |
GdkInputCondition cond) |
242 |
GdkInputCondition cond) |
| 243 |
{ |
243 |
{ |
|
Lines 263-269
Link Here
|
| 263 |
if (_errors >= 5) { |
263 |
if (_errors >= 5) { |
| 264 |
pipe_handler(SIGPIPE); |
264 |
pipe_handler(SIGPIPE); |
| 265 |
} |
265 |
} |
| 266 |
@@ -762,9 +762,9 @@ |
266 |
@@ -762,9 +762,9 @@ void GtkInterface::handle_server_input() |
| 267 |
} |
267 |
} |
| 268 |
|
268 |
|
| 269 |
_errors = 0; |
269 |
_errors = 0; |
|
Lines 275-281
Link Here
|
| 275 |
|
275 |
|
| 276 |
switch(t.peek_char()) { |
276 |
switch(t.peek_char()) { |
| 277 |
case TRAME_ERROR: |
277 |
case TRAME_ERROR: |
| 278 |
@@ -802,14 +802,14 @@ |
278 |
@@ -802,14 +802,14 @@ void GtkInterface::handle_server_input() |
| 279 |
|
279 |
|
| 280 |
case QUIT_GAME: |
280 |
case QUIT_GAME: |
| 281 |
if (_debug) |
281 |
if (_debug) |
|
Lines 293-299
Link Here
|
| 293 |
break; |
293 |
break; |
| 294 |
} |
294 |
} |
| 295 |
} |
295 |
} |
| 296 |
@@ -840,7 +840,7 @@ |
296 |
@@ -840,7 +840,7 @@ void GtkInterface::do_your_other_player( |
| 297 |
int my_other_player_id = t.get_int(); |
297 |
int my_other_player_id = t.get_int(); |
| 298 |
|
298 |
|
| 299 |
if (_debug) |
299 |
if (_debug) |
|
Lines 302-308
Link Here
|
| 302 |
|
302 |
|
| 303 |
Player& p = world.lookup_player(my_other_player_id); |
303 |
Player& p = world.lookup_player(my_other_player_id); |
| 304 |
|
304 |
|
| 305 |
@@ -848,8 +848,8 @@ |
305 |
@@ -848,8 +848,8 @@ void GtkInterface::do_your_other_player( |
| 306 |
|
306 |
|
| 307 |
if (_other_player == NULL) { |
307 |
if (_other_player == NULL) { |
| 308 |
if (_debug) |
308 |
if (_debug) |
|
Lines 313-319
Link Here
|
| 313 |
return; |
313 |
return; |
| 314 |
} |
314 |
} |
| 315 |
|
315 |
|
| 316 |
@@ -870,7 +870,7 @@ |
316 |
@@ -870,7 +870,7 @@ void GtkInterface::do_your_other_player( |
| 317 |
void GtkInterface::do_void_trame() |
317 |
void GtkInterface::do_void_trame() |
| 318 |
{ |
318 |
{ |
| 319 |
if (_debug) |
319 |
if (_debug) |
|
Lines 322-328
Link Here
|
| 322 |
t.get_char(); |
322 |
t.get_char(); |
| 323 |
char *p = t.get_string(); |
323 |
char *p = t.get_string(); |
| 324 |
if (p && strcmp(p, "w") == 0) |
324 |
if (p && strcmp(p, "w") == 0) |
| 325 |
@@ -978,8 +978,8 @@ |
325 |
@@ -978,8 +978,8 @@ void GtkInterface::set_own_player(Player |
| 326 |
|
326 |
|
| 327 |
if (gtk_player == NULL) { |
327 |
if (gtk_player == NULL) { |
| 328 |
if (_debug) |
328 |
if (_debug) |
|
Lines 333-339
Link Here
|
| 333 |
return; |
333 |
return; |
| 334 |
} |
334 |
} |
| 335 |
|
335 |
|
| 336 |
@@ -999,7 +999,7 @@ |
336 |
@@ -999,7 +999,7 @@ void GtkInterface::activate_other_player |
| 337 |
{ |
337 |
{ |
| 338 |
if (_other_player == NULL) { |
338 |
if (_other_player == NULL) { |
| 339 |
if (_debug) |
339 |
if (_debug) |