Пример #1
0
void CGameReviewDialog::OnFirst() 
{
	// undo the last trick
	CEasyBDoc* pDoc = pDOC;
	int numCardsPlayed = pDoc->GetNumCardsPlayedInRound();

	// return if there's nothing to undo
	if ((m_nPlayRound == 0) && (numCardsPlayed == 0))
		return;

	// suppress flashing
	CWaitCursor wait;
	pDoc->SuppressPlayHistoryUpdate(TRUE);
	pMAINFRAME->SetStatusMessage(_T("Backing up to the beginning of play..."));

	// decrement the play round one extra if at the end of play record
	if (m_nPlayRound > m_numTricksAvailable)
		m_nPlayRound--;

	// undo cards from the current trick
	if (numCardsPlayed > 0)
	{
		pDoc->UndoTrick();
		m_nPlayRound--;
		m_nPlayIndex -= numCardsPlayed;
	}

	// and all previous tricks
	while(m_nPlayRound > 0)
	{
		pDoc->UndoPreviousTrick();
		m_nPlayRound--;
		m_nPlayIndex -= 4;
	}

	// and reset
	SetPlayRound(0);

	// hide dummy
	pDOC->ExposeDummy(FALSE);

	// and reset display
	pDoc->ResetDisplay();
	pMAINFRAME->ClearStatusMessage();
	pDoc->SuppressPlayHistoryUpdate(FALSE);
	pDOC->UpdatePlayHistory();

	// done
	return;
}