Subversion Repositories Games.Chess Giants

Rev

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

Rev 178 Rev 185
Line 164... Line 164...
164
   {
164
   {
165
      Debug_Log (L"===Unrecoverable engine error (engine disappeared unexpectedly with exit code %lld): opponent wins!===\n", exit_code);
165
      Debug_Log (L"===Unrecoverable engine error (engine disappeared unexpectedly with exit code %lld): opponent wins!===\n", exit_code);
166
      dont_nag = true; // remember NOT to nag the user if he experienced any bug
166
      dont_nag = true; // remember NOT to nag the user if he experienced any bug
167
 
167
 
168
      // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
168
      // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
169
      Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f);
169
      Audio_PlaySoundAtCenter (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT);
170
 
170
 
171
      // display a crash notification dialog box
171
      // display a crash notification dialog box
172
      if (MessageBox (hMainWnd, LOCALIZE (L"Error_EngineCrashed"), LOCALIZE (L"ImportantMessage"), MB_ICONWARNING | MB_YESNO) == IDYES)
172
      if (MessageBox (hMainWnd, LOCALIZE (L"Error_EngineCrashed"), LOCALIZE (L"ImportantMessage"), MB_ICONWARNING | MB_YESNO) == IDYES)
173
      {
173
      {
174
         sprintf_s ((char *) line_buffer, sizeof (line_buffer), "engine disappeared unexpectedly (exit code %lld)", exit_code);
174
         sprintf_s ((char *) line_buffer, sizeof (line_buffer), "engine disappeared unexpectedly (exit code %lld)", exit_code);
Line 207... Line 207...
207
      else if (wcsstr (line_buffer, L"1/2-1/2") != NULL)
207
      else if (wcsstr (line_buffer, L"1/2-1/2") != NULL)
208
      {
208
      {
209
         Debug_Log (L"===Engine tells us that it's a draw: nobody wins!===\n");
209
         Debug_Log (L"===Engine tells us that it's a draw: nobody wins!===\n");
210
 
210
 
211
         // play defeat sound (a draw is always a sort of defeat...) at the center of the board
211
         // play defeat sound (a draw is always a sort of defeat...) at the center of the board
212
         Audio_PlaySound (SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f);
212
         Audio_PlaySoundAtCenter (SOUNDTYPE_DEFEAT);
213
 
213
 
214
         // display the game over dialog box
214
         // display the game over dialog box
215
         the_board.game_state = STATE_DRAW_OTHER;
215
         the_board.game_state = STATE_DRAW_OTHER;
216
         DialogBox_EndGame ();
216
         DialogBox_EndGame ();
217
 
217
 
Line 223... Line 223...
223
      else if (wcsncmp (line_buffer, L"resign", 6) == 0)
223
      else if (wcsncmp (line_buffer, L"resign", 6) == 0)
224
      {
224
      {
225
         Debug_Log (L"===Engine tells us that %s resigns: %s wins!===\n", (current_player->color == COLOR_BLACK ? "black" : "white"), (current_player->color == COLOR_BLACK ? "white" : "black"));
225
         Debug_Log (L"===Engine tells us that %s resigns: %s wins!===\n", (current_player->color == COLOR_BLACK ? "black" : "white"), (current_player->color == COLOR_BLACK ? "white" : "black"));
226
 
226
 
227
         // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
227
         // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
228
         Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f);
228
         Audio_PlaySoundAtCenter (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT);
229
 
229
 
230
         // display the game over dialog box
230
         // display the game over dialog box
231
         the_board.game_state = (current_player->color == COLOR_BLACK ? STATE_WHITEWIN_RESIGNORFORFEIT : STATE_BLACKWIN_RESIGNORFORFEIT);
231
         the_board.game_state = (current_player->color == COLOR_BLACK ? STATE_WHITEWIN_RESIGNORFORFEIT : STATE_BLACKWIN_RESIGNORFORFEIT);
232
         DialogBox_EndGame ();
232
         DialogBox_EndGame ();
233
 
233
 
Line 247... Line 247...
247
            else
247
            else
248
            {
248
            {
249
               Debug_Log (L"===Engine tells us that black resigns: white wins!===\n");
249
               Debug_Log (L"===Engine tells us that black resigns: white wins!===\n");
250
 
250
 
251
               // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
251
               // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
252
               Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f);
252
               Audio_PlaySoundAtCenter (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT);
253
 
253
 
254
               // display the game over dialog box
254
               // display the game over dialog box
255
               the_board.game_state = STATE_WHITEWIN_RESIGNORFORFEIT;
255
               the_board.game_state = STATE_WHITEWIN_RESIGNORFORFEIT;
256
               DialogBox_EndGame ();
256
               DialogBox_EndGame ();
257
 
257
 
Line 268... Line 268...
268
            else
268
            else
269
            {
269
            {
270
               Debug_Log (L"===Engine tells us that white resigns: black wins!===\n");
270
               Debug_Log (L"===Engine tells us that white resigns: black wins!===\n");
271
 
271
 
272
               // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
272
               // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
273
               Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f);
273
               Audio_PlaySoundAtCenter (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT);
274
 
274
 
275
               // display the game over dialog box
275
               // display the game over dialog box
276
               the_board.game_state = STATE_BLACKWIN_RESIGNORFORFEIT;
276
               the_board.game_state = STATE_BLACKWIN_RESIGNORFORFEIT;
277
               DialogBox_EndGame ();
277
               DialogBox_EndGame ();
278
 
278
 
Line 292... Line 292...
292
      {
292
      {
293
         Debug_Log (L"===Unrecoverable engine error: opponent wins!===\n");
293
         Debug_Log (L"===Unrecoverable engine error: opponent wins!===\n");
294
         dont_nag = true; // remember NOT to nag the user if he experienced any bug
294
         dont_nag = true; // remember NOT to nag the user if he experienced any bug
295
 
295
 
296
         // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
296
         // if opponent player is human, play the victory sound, else, play defeat sound at the center of the board
297
         Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f);
297
         Audio_PlaySoundAtCenter (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT);
298
 
298
 
299
         // display a crash notification dialog box
299
         // display a crash notification dialog box
300
         if (MessageBox (hMainWnd, LOCALIZE (L"Error_EngineCrashed"), LOCALIZE (L"ImportantMessage"), MB_ICONWARNING | MB_YESNO) == IDYES)
300
         if (MessageBox (hMainWnd, LOCALIZE (L"Error_EngineCrashed"), LOCALIZE (L"ImportantMessage"), MB_ICONWARNING | MB_YESNO) == IDYES)
301
            if (Debug_SendLogToAuthor ("engine refused our command", true))
301
            if (Debug_SendLogToAuthor ("engine refused our command", true))
302
               MessageBox (hMainWnd, LOCALIZE (L"MessageSent"), PROGRAM_NAME, MB_ICONINFORMATION | MB_OK); // send the game engine history to the author
302
               MessageBox (hMainWnd, LOCALIZE (L"MessageSent"), PROGRAM_NAME, MB_ICONINFORMATION | MB_OK); // send the game engine history to the author