src/terminal-chess.h

changeset 30
a285ee393860
parent 26
e0a76ee1bb2b
child 47
d726e4b46c33
equal deleted inserted replaced
29:c6a1ad6cf749 30:a285ee393860
29 29
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <stdio.h> 31 #include <stdio.h>
32 #include <ncurses.h> 32 #include <ncurses.h>
33 #include "network.h" 33 #include "network.h"
34 #include "chess/rules.h"
34 35
35 #ifndef TERMINAL_CHESS_H 36 #ifndef TERMINAL_CHESS_H
36 #define TERMINAL_CHESS_H 37 #define TERMINAL_CHESS_H
37 38
38 #ifdef __cplusplus 39 #ifdef __cplusplus
39 extern "C" { 40 extern "C" {
40 #endif 41 #endif
41 42
42 #define TIME_MAX UINT16_MAX
43
44 typedef struct { 43 typedef struct {
45 uint8_t servercolor; 44 GameInfo gameinfo;
46 uint16_t time;
47 uint16_t addtime;
48 } Gameinfo;
49
50 typedef struct {
51 Gameinfo gameinfo;
52 char* port; 45 char* port;
53 char* serverhost; /* NULL, if we are about to start a server */ 46 char* serverhost; /* NULL, if we are about to start a server */
54 _Bool printhelp; 47 _Bool printhelp;
55 _Bool singlemachine; 48 _Bool singlemachine;
56 } Settings; 49 } Settings;
57 50
58 #define is_server(settings) !((settings)->serverhost) 51 #define is_server(settings) !((settings)->serverhost)
59 52
60 void dump_gameinfo(Gameinfo *gameinfo); 53 void dump_gameinfo(GameInfo *gameinfo);
61 54
62 int server_run(Settings* settings); 55 int server_run(Settings* settings);
63 int client_run(Settings* settings); 56 int client_run(Settings* settings);
64 57
65 #ifdef __cplusplus 58 #ifdef __cplusplus

mercurial