allow resetting games
This commit is contained in:
@@ -19,6 +19,19 @@ Bag::Bag(std::shared_ptr<PiecesList> piecesList) :
|
||||
this->prepareNext();
|
||||
}
|
||||
|
||||
void Bag::jumpToNextBag() {
|
||||
// if the bag is empty switch to the next bag
|
||||
if (this->currentBag.empty()) {
|
||||
std::swap(this->currentBag, this->nextBag);
|
||||
}
|
||||
|
||||
// get the already used pieces back to the current bag
|
||||
for (const std::pair<int, int>& pieceIndex : this->nextBag) {
|
||||
this->currentBag.emplace_back(pieceIndex);
|
||||
}
|
||||
this->nextBag.clear();
|
||||
}
|
||||
|
||||
Piece Bag::lookNext() {
|
||||
return this->piecesList->getPiece(this->next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user