Rev 79 | Rev 116 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 79 | Rev 86 | ||
|---|---|---|---|
| Line 242... | Line 242... | ||
| 242 | { |
242 | { |
| 243 | // is it an empty line or engine noise ? |
243 | // is it an empty line or engine noise ? |
| 244 | if ((line_buffer[0] == 0) || iswspace (line_buffer[0])) |
244 | if ((line_buffer[0] == 0) || iswspace (line_buffer[0])) |
| 245 | continue; // skip empty lines and engine noise |
245 | continue; // skip empty lines and engine noise |
| 246 | 246 | ||
| - | 247 | // is the engine offering us a draw ? |
|
| - | 248 | if (wcsncmp (line_buffer, L"offer draw", 10) == 0) |
|
| - | 249 | continue; // if so, discard its offer (engine draws are unsupported) and proceed to the next line |
|
| - | 250 | ||
| 247 | // is |
251 | // else is it an *irrevocable* draw ? (at this point there's nothing we can do but accept it) |
| 248 | if ( |
252 | else if (wcsstr (line_buffer, L"1/2-1/2") != NULL) |
| 249 | { |
253 | { |
| - | 254 | Debug_Log (L"===Engine tells us that it's a draw: nobody wins!===\n"); |
|
| - | 255 | ||
| - | 256 | // play defeat sound (a draw is always a sort of defeat...) |
|
| 250 |
|
257 | Audio_PlaySound (SOUNDTYPE_DEFEAT); |
| - | 258 | ||
| - | 259 | // display the game over dialog box |
|
| - | 260 | the_board.game_state = STATE_DRAW_OTHER; |
|
| - | 261 | DialogBox_EndGame (); |
|
| - | 262 | ||
| 251 |
|
263 | do_update = true; // remember to update the 3D scene |
| - | 264 | continue; // we processed that line |
|
| 252 |
|
265 | } |
| - | 266 | ||
| - | 267 | // else is the engine *irrevocably* resigning ? (at this point there's nothing we can do but accept it) |
|
| 253 |
|
268 | else if (wcsncmp (line_buffer, L"resign", 6) == 0) |
| - | 269 | { |
|
| - | 270 | 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")); |
|
| 254 | 271 | ||
| 255 | // if opponent player is human, play the victory sound, else, play defeat sound |
272 | // if opponent player is human, play the victory sound, else, play defeat sound |
| 256 | Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT); |
273 | Audio_PlaySound (opposite_player->type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT); |
| 257 | 274 | ||
| 258 | // display the game over dialog box |
275 | // display the game over dialog box |
| 259 | if (current_player->color == COLOR_BLACK) |
- | |
| 260 | the_board.game_state = STATE_WHITEWIN_RESIGNORFORFEIT; |
- | |
| 261 | else |
- | |
| 262 |
|
276 | the_board.game_state = (current_player->color == COLOR_BLACK ? STATE_WHITEWIN_RESIGNORFORFEIT : STATE_BLACKWIN_RESIGNORFORFEIT); |
| 263 | DialogBox_EndGame (); |
277 | DialogBox_EndGame (); |
| 264 | 278 | ||
| 265 | do_update = true; // remember to update the 3D scene |
279 | do_update = true; // remember to update the 3D scene |
| 266 | - | ||
| 267 | continue; // we processed that line |
280 | continue; // we processed that line |
| 268 | } |
281 | } |
| 269 | - | ||
| 270 | // else is the engine offering us a draw ? |
- | |
| 271 | if (wcsncmp (line_buffer, L"offer draw", 6) == 0) |
- | |
| 272 | continue; // if so, discard its offer (engine draws are unsupported) and proceed to the next line |
- | |
| 273 | 282 | ||
| 274 | // is engine allowed to resign ? if so, check if it's a game results |
283 | // is engine allowed to resign ? if so, check if it's a game results |
| 275 | if (options.engine.obstinacy_level >= 0) |
284 | if (options.engine.obstinacy_level >= 0) |
| 276 | { |
285 | { |
| 277 | // is it a game result AND are we still in play ? |
286 | // is it a game result AND are we still in play ? |