void GameMechanics::ProcessHoldPieceSwapCommand_Release() { if (_isPaused) return; if (_holdPieceInUse) return; _holdPieceInUse = true; PieceType::e currentPieceType = _grid.GetCurrentPiece().GetPieceType(); Piece holdPiece = _holdPieceQueue.PushNewPiece(_pieceFactory.CreatePiece(currentPieceType, GameSettings::BlockSizeForQueue)); PieceType::e holdPieceType = holdPiece.GetPieceType(); if (holdPieceType == PieceType::none) { // no hold piece present yet spawnNextPieceFromQueue(); } else { spawnSpecificPiece(holdPieceType); } }
void GameMechanics::spawnNextPieceFromQueue() { Piece nextFromQueue = _pieceQueue.PushNewPiece(_pieceFactory.CreateRandomPiece(GameSettings::BlockSizeForQueue)); spawnSpecificPiece(nextFromQueue.GetPieceType()); }