[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bknights=5D_src=3A_Say_=22Checkmate=22_when_there=27?=
From:       Miha Čančula <miha.cancula () gmail ! com>
Date:       2011-03-06 20:17:30
Message-ID: 20110306201730.312FBA60C6 () git ! kde ! org
[Download RAW message or body]

Git commit 6be156d79e75e2c53c02b1f187ed400e3fee317f by Miha Čančula.
Committed on 06/03/2011 at 21:14.
Pushed by mihac into branch 'master'.

Say "Checkmate" when there's a checkmate, otherwise just "Check"

M  +9    -1    src/gamemanager.cpp     

http://commits.kde.org/knights/6be156d79e75e2c53c02b1f187ed400e3fee317f

diff --git a/src/gamemanager.cpp b/src/gamemanager.cpp
index e98e3b5..aa2b41b 100644
--- a/src/gamemanager.cpp
+++ b/src/gamemanager.cpp
@@ -633,9 +633,17 @@ void Manager::sendPendingMove()
         }
         kDebug() << toSpeak;
         d->speech->say(toSpeak, KSpeech::soPlainText);
+        
         if ( pendingMove.flag(Move::Check) )
         {
-            d->speech->say ( i18nc( "Your king is under attack", "Check" ), KSpeech::soPlainText );
+            if ( d->rules->hasLegalMoves ( oppositeColor( d->activePlayer ) ) )
+            {
+                d->speech->say ( i18nc( "Your king is under attack", "Check" ), KSpeech::soPlainText );
+            }
+            else
+            {
+                d->speech->say ( i18nc( "Your king is dead", "Checkmate" ), KSpeech::soPlainText );
+            }
         }
     }
     


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic