| 37 extern "C" { |
37 extern "C" { |
| 38 #endif |
38 #endif |
| 39 |
39 |
| 40 typedef struct { |
40 typedef struct { |
| 41 GameInfo gameinfo; |
41 GameInfo gameinfo; |
| 42 char* serverhost; /* NULL, if we are about to start a server */ |
42 /** |
| |
43 * Server host address. |
| |
44 * TCP: server address or \c NULL when we are the server |
| |
45 * Domain Socket: the path to the domain socket |
| |
46 */ |
| |
47 char* serverhost; |
| 43 char* continuepgn; |
48 char* continuepgn; |
| 44 short port; |
49 short port; |
| |
50 bool ishost; |
| |
51 bool usedomainsocket; |
| 45 bool singlemachine; |
52 bool singlemachine; |
| 46 bool disableflip; |
53 bool disableflip; |
| 47 bool unicode; |
54 bool unicode; |
| 48 } Settings; |
55 } Settings; |
| 49 |
56 |
| 50 #define is_server(settings) !((settings)->serverhost) |
|
| 51 |
|
| 52 void game_play_singlemachine(Settings *settings); |
57 void game_play_singlemachine(Settings *settings); |
| 53 |
58 |
| |
59 /** |
| |
60 * Plays a network game of chess. |
| |
61 * |
| |
62 * @param settings the game settings |
| |
63 * @param gamestate the current game state |
| |
64 * @param opponent file descriptor for the opponent |
| |
65 */ |
| 54 void game_play(Settings *settings, GameState *gamestate, int opponent); |
66 void game_play(Settings *settings, GameState *gamestate, int opponent); |
| 55 void game_review(Settings* settings, GameState *gamestate); |
67 void game_review(Settings* settings, GameState *gamestate); |
| 56 |
68 |
| 57 int server_run(Settings* settings); |
69 int server_run(Settings* settings); |
| 58 int client_run(Settings* settings); |
70 int client_run(Settings* settings); |