Subversion Repositories Games.Chess Giants

Rev

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

Rev 50 Rev 53
Line 217... Line 217...
217
   while ((line_pointer = ReadACompleteLine (line_buffer, WCHAR_SIZEOF (line_buffer), line_pointer)) != NULL)
217
   while ((line_pointer = ReadACompleteLine (line_buffer, WCHAR_SIZEOF (line_buffer), line_pointer)) != NULL)
218
   {
218
   {
219
      // is it an empty line or engine noise ?
219
      // is it an empty line or engine noise ?
220
      if ((line_buffer[0] == 0) || iswspace (line_buffer[0]))
220
      if ((line_buffer[0] == 0) || iswspace (line_buffer[0]))
221
         continue; // skip empty lines and engine noise
221
         continue; // skip empty lines and engine noise
-
 
222
 
-
 
223
      // is the engine *irrevocably* resigning ? (at this point there's nothing we can do but accept it)
-
 
224
      if (wcsncmp (line_buffer, L"resign", 6) == 0)
-
 
225
      {
-
 
226
         if (current_player->color == COLOR_BLACK)
-
 
227
            Debug_Log (L"===Engine tells us that black resigns: white wins!===\n");
-
 
228
         else
-
 
229
            Debug_Log (L"===Engine tells us that white resigns: black wins!===\n");
-
 
230
 
-
 
231
         // if opponent player is human, play the victory sound, else, play defeat sound
-
 
232
         Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT);
-
 
233
 
-
 
234
         // display the game over dialog box
-
 
235
         if (current_player->color == COLOR_BLACK)
-
 
236
            the_board.game_state = STATE_WHITEWIN_RESIGNORFORFEIT;
-
 
237
         else
-
 
238
            the_board.game_state = STATE_BLACKWIN_RESIGNORFORFEIT;
-
 
239
         DialogBox_EndGame ();
-
 
240
 
-
 
241
         do_update = true; // remember to update the 3D scene
-
 
242
 
-
 
243
         continue; // we processed that line
-
 
244
      }
-
 
245
 
-
 
246
      // else is the engine offering us a draw ?
-
 
247
      if (wcsncmp (line_buffer, L"offer draw", 6) == 0)
-
 
248
         continue; // if so, discard its offer (engine draws are unsupported) and proceed to the next line
222
 
249
 
223
      // is engine allowed to resign ? if so, check if it's a game results
250
      // is engine allowed to resign ? if so, check if it's a game results
224
      if (options.engine.obstinacy_level >= 0)
251
      if (options.engine.obstinacy_level >= 0)
225
      {
252
      {
226
         // is it a game result AND are we still in play ?
253
         // is it a game result AND are we still in play ?