[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bknights/2=2E3=5D_src=3A_Apply_per-move_time_increme?=
From: Miha Čančula <miha.cancula () gmail ! com>
Date: 2011-02-27 10:02:13
Message-ID: 20110227100213.09D3CA60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 2e4ec6e7912a04619f325dbb1bf26594a3c7e846 by Miha Čančula.
Committed on 27/02/2011 at 10:51.
Pushed by mihac into branch '2.3'.
Apply per-move time incremets.
M +19 -2 src/gamemanager.cpp
http://commits.kde.org/knights/2e4ec6e7912a04619f325dbb1bf26594a3c7e846
diff --git a/src/gamemanager.cpp b/src/gamemanager.cpp
index 3bdfa20..4a027a9 100644
--- a/src/gamemanager.cpp
+++ b/src/gamemanager.cpp
@@ -627,21 +627,38 @@ void Manager::sendPendingMove()
}
int moveNumber;
+ int secondsAdded = 0;
switch ( d->activePlayer )
{
case White:
moveNumber = ( d->moveHistory.size() + 1 ) / 2;
+ if ( moveNumber > 1 )
+ {
+ secondsAdded += d->whiteTimeControl.increment;
+ }
if ( d->whiteTimeControl.moves > 0 && ( moveNumber % d->whiteTimeControl.moves ) == \
0 ) {
- setCurrentTime ( White, d->whiteTimeControl.currentTime.addSecs ( \
d->whiteTimeControl.baseTime.minute() * 60 ) ); + secondsAdded += QTime().secsTo( \
d->whiteTimeControl.baseTime ); + }
+ if ( secondsAdded != 0 )
+ {
+ setCurrentTime ( White, d->whiteTimeControl.currentTime.addSecs ( secondsAdded ) \
); }
break;
case Black:
moveNumber = d->moveHistory.size() / 2;
+ if ( moveNumber > 1 )
+ {
+ secondsAdded += d->blackTimeControl.increment;
+ }
if ( d->blackTimeControl.moves > 0 && ( moveNumber % d->blackTimeControl.moves ) == \
0 ) {
- setCurrentTime ( Black, d->blackTimeControl.currentTime.addSecs ( \
d->blackTimeControl.baseTime.minute() * 60 ) ); + secondsAdded += QTime().secsTo ( \
d->blackTimeControl.baseTime ); + }
+ if ( secondsAdded != 0 )
+ {
+ setCurrentTime ( Black, d->blackTimeControl.currentTime.addSecs ( secondsAdded ) \
); }
break;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic