src/game.c

changeset 45
e14a1d9aa91d
parent 44
1891d88cbd10
child 46
4dcfb4c58b6d
equal deleted inserted replaced
44:1891d88cbd10 45:e14a1d9aa91d
325 } 325 }
326 } 326 }
327 327
328 static int recvmove(GameState *gamestate, GameInfo *gameinfo, int opponent) { 328 static int recvmove(GameState *gamestate, GameInfo *gameinfo, int opponent) {
329 329
330 if (net_setnonblocking(opponent, 1)) {
331 printw("Cannot setup nonblocking IO on network socket");
332 cbreak(); getch();
333 exit(EXIT_FAILURE);
334 }
335
336 struct timeval timeout; 330 struct timeval timeout;
337 while (1) { 331 while (1) {
338 timecontrol(gamestate, gameinfo); 332 timecontrol(gamestate, gameinfo);
339 333
340 move(inputy, 0); 334 move(inputy, 0);
400 } 394 }
401 return 0; 395 return 0;
402 } else { 396 } else {
403 net_send_code(opponent, NETCODE_DECLINE); 397 net_send_code(opponent, NETCODE_DECLINE);
404 } 398 }
399 break;
400 default:
401 printw("\nInvalid network request.");
405 } 402 }
406 } 403 }
407 } 404 }
408 } 405 }
409 406

mercurial