void __fastcall TIntMinerField::HandleEvGameStatusChanged(System::TObject* Sender, TGameStatus AGameStatus, const TGameDifficulty &AGameDifficulty, TCells &AChangedCells, TCells &ARedCells)
{
  switch (AGameStatus) {
    case gsNew: {
      FGameStatus = gsNew;
      FGameDifficulty = AGameDifficulty;
      InitNewGame();
    }; break;
    case gsRun: FGameStatus = gsRun; break;
    case gsLost: {
      FGameStatus = gsLost;
      UpdateMinerFieldState(ARedCells);
      InvalidateCells(AChangedCells, ARedCells);
      FGrid->Views[0]->Painter->Invalidate();
	  FGrid->Enabled = false;
    }; break;
    case gsWon: {
      FGameStatus = gsWon;
      UpdateMinerFieldState(ARedCells);
      InvalidateCells(AChangedCells, ARedCells);
      FGrid->Views[0]->Painter->Invalidate();
	  FGrid->Enabled = false;
    }; break;
  };
  ARedCells.Length = 0;
  AChangedCells.Length = 0;
  FireGameStatusChanged(Sender, AGameStatus, AGameDifficulty);
}
Exemple #2
0
static void PASCAL ChangeUpdateRow (int newrow)
/* Set UpdateRow to newrow, invalidating the changed cells in the
   previous update row */
{
    if ((UpdateCol.rightmost >= 0) && (UpdateRow >= 0)) {
        InvalidateCells (hIOWnd, UpdateCol.leftmost, UpdateRow,
                         UpdateCol.rightmost, UpdateRow);
    }
    UpdateRow = newrow;
} /* ChangeUpdateRow */
void __fastcall TIntMinerField::HandleEvMinerFieldChanged(System::TObject* Sender, TCells &AChangedCells, TCells &ARedCells)
{
  InvalidateCells(AChangedCells, ARedCells);
//  AChangedCells.Length = 0;
//  ARedCells.Length = 0;
}