ChessClock::addTime() for time controllers to work
authorArto Hyvättinen <arto.hyvattinen@gmail.com>
Fri, 13 Aug 2010 23:28:44 +0000 (02:28 +0300)
committerArto Hyvättinen <arto.hyvattinen@gmail.com>
Fri, 13 Aug 2010 23:28:44 +0000 (02:28 +0300)
classes/chessclock.cpp
classes/chessclock.h

index d3b169a..a0d884f 100644 (file)
@@ -93,7 +93,7 @@ TurnInformation* ChessClock::endTurn()
     currentTurn_->turnReady(timeAvailableBeforeTurn_ );
     TurnInformation* information = currentTurn_;
     currentTurn_ = 0;
-    emit endTurn();
+    emit turnEnded();
     return information;
 }
 
@@ -132,6 +132,12 @@ void ChessClock::setTimeAvailable(int msecs)
     timeAvailableBeforeTurn_ = msecs;
 }
 
+
+void ChessClock::addTime(int msecs)
+{
+   timeAvailableBeforeTurn_ += msecs;
+}
+
 void ChessClock::updateClock()
 {
     // Check loser
index d9f599f..4ab58cc 100644 (file)
@@ -94,10 +94,18 @@ public:
       @param msecs Time available in msecs */
     void setTimeAvailable(int msecs);
 
+    /*! Add time
+
+      Add time to timeAvailableBeforeTurn_ total available time
+      counter.
+
+      @param msecs Time to add in msecs */
+    void addTime(int msecs);
+
 
 signals:
     void timeOutLoser();
-    void endTurn();
+    void turnEnded();
 
 public slots: