Only display claim draw dialog if game has started
We should also probably decide whether the game has started before scheduling the timeout, since that's a 100ms window for everything to break, otherwise. Fixes #22
This commit is contained in:
parent
ea79e9471f
commit
9b892882b1
1 changed files with 3 additions and 2 deletions
|
@ -1124,15 +1124,16 @@ Copyright © 2015–2016 Sahil Sareen""";
|
|||
/* Remaining work goes in a timeout to give the game widget a chance to
|
||||
* redraw first, so the pieces are shown to move before displaying the
|
||||
* claim draw dialog. */
|
||||
var started = !starting && game.is_started;
|
||||
Timeout.add(100, () => {
|
||||
if (game.can_claim_draw ())
|
||||
if (game.can_claim_draw () && started)
|
||||
present_claim_draw_dialog ();
|
||||
|
||||
if (opponent_engine != null)
|
||||
{
|
||||
opponent_engine.report_move (move);
|
||||
|
||||
if (move.piece.color != opponent.color && !starting && game.is_started)
|
||||
if (move.piece.color != opponent.color && started)
|
||||
opponent_engine.move ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue