void TestMines( BOARD *p_board, POINT pt, int msg ) { BOOL draw = TRUE; int col, row; col = (pt.x - p_board->mines_rect.left) / MINE_WIDTH + 1; row = (pt.y - p_board->mines_rect.top ) / MINE_HEIGHT + 1; switch ( msg ) { case WM_LBUTTONDOWN: if( p_board->press.x != col || p_board->press.y != row ) { UnpressBox( p_board, p_board->press.x, p_board->press.y ); p_board->press.x = col; p_board->press.y = row; PressBox( p_board, col, row ); } draw = FALSE; break; case WM_LBUTTONUP: if( p_board->press.x != col || p_board->press.y != row ) UnpressBox( p_board, p_board->press.x, p_board->press.y ); p_board->press.x = 0; p_board->press.y = 0; if( p_board->box[col][row].FlagType != FLAG && p_board->status != PLAYING ) { p_board->status = PLAYING; PlaceMines( p_board, col, row ); } CompleteBox( p_board, col, row ); break; case WM_MBUTTONDOWN: PressBoxes( p_board, col, row ); draw = FALSE; break; case WM_MBUTTONUP: if( p_board->press.x != col || p_board->press.y != row ) UnpressBoxes( p_board, p_board->press.x, p_board->press.y ); p_board->press.x = 0; p_board->press.y = 0; CompleteBoxes( p_board, col, row ); break; case WM_RBUTTONDOWN: AddFlag( p_board, col, row ); break; default: WINE_TRACE("Unknown message type received in TestMines\n"); break; } if( draw ) { RedrawWindow( p_board->hWnd, NULL, 0, RDW_INVALIDATE | RDW_UPDATENOW ); } }
void minefield::GenerateField() { PlaceMines(); }