#pragma once #include "../Pieces/Piece.h" #include #include /** * A container for all loaded pieces to prevent loading and copying them multiple times, * also allows for the player to select a list of pieces to be used in a game */ class PiecesList { private: int highestLoadedSize; // the highest size of pieces currently loaded std::vector> loadedPieces; // every loaded pieces by size std::vector> convexPieces; // the list of convex loaded pieces by size std::vector> holelessPieces; // the list of holeless loaded pieces by size std::vector> otherPieces; // the list of other loaded pieces by size std::vector> selectedPieces; // the list of all currently selected pieces public: /** * Initializes a list of pieces up to size 0 (so no pieces) */ PiecesList(); /** * Makes the list load all pieces of the specified size * @return If it sucessfully loaded the pieces */ bool loadPieces(int size); /** * Selects the specified piece * @return If the piece could be selected */ bool selectPiece(int size, int number); /** * Selects all pieces of the specified size * @return If the pieces could be selected */ bool selectAllPieces(int size); /** * Selects all convex pieces of the specified size * @return If the pieces could be selected */ bool selectConvexPieces(int size); /** * Selects all holeless pieces of the specified size * @return If the pieces could be selected */ bool selectHolelessPieces(int size); /** * Selects all other pieces of the specified size * @return If the pieces could be selected */ bool selectOtherPieces(int size); /** * Unselects all previously selected pieces */ void unselectAll(); /** * @return The highest loaded size of pieces */ int getHighestLoadedSize() const; /** * @return The number of pieces of the specified size */ int getNumberOfPieces(int size) const; /** * @return A copy of the indexes of all selected pieces */ std::vector> getSelectedPieces() const; /** * @return A copy of the piece corresponding to the specified index */ Piece getPiece(const std::pair& pieceIndex) const; private: /** * Adds empty vectors at the end of every pieces list */ void pushBackEmptyVectors(); };