76 } |
76 } |
77 |
77 |
78 int fd = server.client->fd; |
78 int fd = server.client->fd; |
79 net_send_data(fd, NETCODE_GAMEINFO, |
79 net_send_data(fd, NETCODE_GAMEINFO, |
80 &(settings->gameinfo), sizeof(GameInfo)); |
80 &(settings->gameinfo), sizeof(GameInfo)); |
81 printw("\rClient connected - awaiting challenge acceptance..."); |
81 addstr("\rClient connected - awaiting challenge acceptance..."); |
82 refresh(); |
82 refresh(); |
83 int code = net_recieve_code(fd); |
83 int code = net_recieve_code(fd); |
84 if (code == NETCODE_ACCEPT) { |
84 if (code == NETCODE_ACCEPT) { |
85 printw("\rClient connected - challenge accepted."); |
85 addstr("\rClient connected - challenge accepted."); |
86 clrtoeol(); |
86 clrtoeol(); |
87 |
87 |
88 game_start(settings, fd); |
88 game_start(settings, fd); |
89 } else if (code == NETCODE_DECLINE) { |
89 } else if (code == NETCODE_DECLINE) { |
90 printw("\rClient connected - challenge declined."); |
90 addstr("\rClient connected - challenge declined."); |
|
91 clrtoeol(); |
|
92 } else if (code == NETCODE_CONNLOST) { |
|
93 addstr("\rClient connected - but gave no response."); |
91 clrtoeol(); |
94 clrtoeol(); |
92 } else { |
95 } else { |
93 addstr("\rInvalid client response"); |
96 addstr("\rInvalid client response"); |
94 clrtoeol(); |
97 clrtoeol(); |
95 |
98 |