added distribution menu

This commit is contained in:
2025-03-29 21:57:27 +01:00
parent 7151be0b1a
commit 314b7a8488
12 changed files with 207 additions and 40 deletions

View File

@@ -1,21 +1,12 @@
#pragma once
#include "../Pieces/Piece.h"
#include "DistributionMode.h"
#include <vector>
#include <utility>
/**
* The type of pieces distribution managed by the game
*/
enum PiecesDistributionMode {
DEFAULT,
UNIFORM,
CUSTOM
};
/**
* 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
@@ -28,7 +19,7 @@ class PiecesList {
std::vector<std::vector<int>> holelessPieces; // the list of holeless loaded pieces by size
std::vector<std::vector<int>> otherPieces; // the list of other loaded pieces by size
std::vector<std::pair<int, int>> selectedPieces; // the list of all currently selected pieces
PiecesDistributionMode distributionMode; // the current pieces distribution mode
DistributionMode distributionMode; // the current pieces distribution mode
std::vector<double> proportionsPerSize; // the proportion of piece for each sizes
std::vector<double> customProportionsPerSize; // the proportion of piece for each sizes when the distribution mode is set to custom
@@ -83,7 +74,7 @@ class PiecesList {
* Changes the current pieces distribution mode
* @return If the mode is supported
*/
bool setDistributionMode(PiecesDistributionMode distributionMode);
bool setDistributionMode(DistributionMode distributionMode);
/**
* Changes the distribution of the specified size for when the distribution mode is set to custom,
@@ -110,7 +101,7 @@ class PiecesList {
/**
* @return The current distribution mode
*/
PiecesDistributionMode getDistributionMode() const;
DistributionMode getDistributionMode() const;
/**
* @return The proportion of pieces for each loaded size