src/main.c

changeset 30
a285ee393860
parent 29
c6a1ad6cf749
child 31
ed440bcd9740
     1.1 --- a/src/main.c	Mon Apr 07 14:08:57 2014 +0200
     1.2 +++ b/src/main.c	Mon Apr 07 17:39:46 2014 +0200
     1.3 @@ -59,11 +59,13 @@
     1.4                  timeunit = 1;
     1.5              }
     1.6              
     1.7 -            if ((time = strtoul(optarg, &valid, 10)) > TIME_MAX
     1.8 +            if ((time = strtoul(optarg, &valid, 10))*timeunit > UINT16_MAX
     1.9                  || *valid != '\0') {
    1.10 -                fprintf(stderr, "Specified time is invalid (%s)\n", optarg);
    1.11 +                fprintf(stderr, "Specified time is invalid (%s)"
    1.12 +                    "- Maximum: 65535 seconds (1092 minutes)\n", optarg);
    1.13                  return 1;
    1.14              } else {
    1.15 +                settings->gameinfo.timecontrol = 1;
    1.16                  if (opt=='t') {
    1.17                      settings->gameinfo.time = timeunit * time;
    1.18                  } else {
    1.19 @@ -108,7 +110,7 @@
    1.20      return settings;
    1.21  }
    1.22  
    1.23 -void dump_gameinfo(Gameinfo *gameinfo) {
    1.24 +void dump_gameinfo(GameInfo *gameinfo) {
    1.25      int serverwhite = gameinfo->servercolor == WHITE;
    1.26      attron(A_UNDERLINE);
    1.27      printw("Game details\n");
    1.28 @@ -116,7 +118,7 @@
    1.29      printw("  Server:     %s\n  Client:     %s\n",
    1.30          serverwhite?"white":"black", serverwhite?"black":"White"
    1.31      );
    1.32 -    if (gameinfo->time > 0) {
    1.33 +    if (gameinfo->timecontrol) {
    1.34          if (gameinfo->time % 60) {
    1.35              printw("  Time limit: %ds + %ds\n",
    1.36                  gameinfo->time, gameinfo->addtime);
    1.37 @@ -163,7 +165,7 @@
    1.38          return EXIT_SUCCESS;
    1.39      }    
    1.40      initscr();
    1.41 -    cbreak();
    1.42 +    halfdelay(10);
    1.43      keypad(stdscr, TRUE);
    1.44      if (has_colors()) {
    1.45          start_color();

mercurial