Subversion Repositories Games.Chess Giants

Rev

Rev 33 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33 Rev 108
Line 16... Line 16...
16
 *   it were played out as well.                                               *
16
 *   it were played out as well.                                               *
17
 *                                                                             *
17
 *                                                                             *
18
 *******************************************************************************
18
 *******************************************************************************
19
 */
19
 */
20
void ResignOrDraw(TREE * RESTRICT tree, int value) {
20
void ResignOrDraw(TREE * RESTRICT tree, int value) {
21
  int result = 0;
21
  int v, result = 0;
22
 
22
 
23
/*
23
/*
24
 ************************************************************
24
 ************************************************************
25
 *                                                          *
25
 *                                                          *
26
 *  If the game is a technical draw, where there are no     *
26
 *  If the game is a technical draw, where there are no     *
Line 107... Line 107...
107
    if (audible_alarm)
107
    if (audible_alarm)
108
      printf("%c", audible_alarm);
108
      printf("%c", audible_alarm);
109
    if (speech) {
109
    if (speech) {
110
      char announce[128];
110
      char announce[128];
111
 
111
 
112
      strcpy_s(announce, sizeof (announce), SPEAK); // Pierre-Marie Baty -- use safe version
112
      strcpy(announce, "./speak ");
113
      strcat_s(announce, sizeof (announce), "Resign"); // Pierre-Marie Baty -- use safe version
113
      strcat(announce, "Resign");
114
      system(announce);
114
      v = system(announce);
-
 
115
      if (v <= 0)
-
 
116
        perror("ResignOrDraw() system() error: ");
115
    }
117
    }
116
    if (crafty_is_white) {
118
    if (crafty_is_white) {
117
      Print(4095, "0-1 {White resigns}\n");
119
      Print(4095, "0-1 {White resigns}\n");
118
      strcpy_s(pgn_result, sizeof (pgn_result), "0-1"); // Pierre-Marie Baty -- use safe version
120
      strcpy(pgn_result, "0-1");
119
    } else {
121
    } else {
120
      Print(4095, "1-0 {Black resigns}\n");
122
      Print(4095, "1-0 {Black resigns}\n");
121
      strcpy_s(pgn_result, sizeof (pgn_result), "1-0"); // Pierre-Marie Baty -- use safe version
123
      strcpy(pgn_result, "1-0");
122
    }
124
    }
123
  }
125
  }
124
  if (offer_draws && result == 2) {
126
  if (offer_draws && result == 2) {
125
    draw_offered = 1;
127
    draw_offered = 1;
126
    if (!xboard) {
128
    if (!xboard) {
127
      Print(128, "\nI offer a draw.\n\n");
129
      Print(1, "\nI offer a draw.\n\n");
128
      if (audible_alarm)
130
      if (audible_alarm)
129
        printf("%c", audible_alarm);
131
        printf("%c", audible_alarm);
130
      if (speech) {
132
      if (speech) {
131
        char announce[128];
133
        char announce[128];
132
 
134
 
133
        strcpy_s(announce, sizeof (announce), SPEAK); // Pierre-Marie Baty -- use safe version
135
        strcpy(announce, "./speak ");
134
        strcat_s(announce, sizeof (announce), "Drawoffer"); // Pierre-Marie Baty -- use safe version
136
        strcat(announce, "Drawoffer");
135
        system(announce);
137
        v = system(announce);
-
 
138
        if (v <= 0)
-
 
139
          perror("ResignOrDraw() system() error: ");
136
      }
140
      }
137
    } else if (xboard)
141
    } else if (xboard)
138
      Print(4095, "offer draw\n");
142
      Print(4095, "offer draw\n");
139
    else
143
    else
140
      Print(4095, "\n*draw\n");
144
      Print(4095, "\n*draw\n");