void TimeControl::update() { m_lastMoveTime = m_time.elapsed(); if (!m_infinite && m_lastMoveTime > m_timeLeft + m_expiryMargin) m_expired = true; if (m_timePerMove != 0) setTimeLeft(m_timePerMove); else { setTimeLeft(m_timeLeft + m_increment - m_lastMoveTime); if (m_movesPerTc > 0) { setMovesLeft(m_movesLeft - 1); // Restart the time control if (m_movesLeft == 0) { setMovesLeft(m_movesPerTc); setTimeLeft(m_timePerTc + m_timeLeft); } } } }
void TimeControl::update() { /* * This will overflow after roughly 49 days however it's unlikely * we'll ever hit that limit. */ m_lastMoveTime = (int)m_time.elapsed(); if (!m_infinite && m_lastMoveTime > m_timeLeft + m_expiryMargin) m_expired = true; if (m_timePerMove != 0) setTimeLeft(m_timePerMove); else { setTimeLeft(m_timeLeft + m_increment - m_lastMoveTime); if (m_movesPerTc > 0) { setMovesLeft(m_movesLeft - 1); // Restart the time control if (m_movesLeft == 0) { setMovesLeft(m_movesPerTc); setTimeLeft(m_timePerTc + m_timeLeft); } } } }