pair madness

This commit is contained in:
Mylloon 2024-01-11 19:37:39 +01:00
parent fcb90e5214
commit a00d901671
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
7 changed files with 9 additions and 11 deletions

View file

@ -209,5 +209,5 @@ Position Butin::calculpoints(const bool end) const {
} }
} }
return std::make_pair(j1, j2); return {j1, j2};
} }

View file

@ -111,13 +111,13 @@ bool PlateauButin::coupsPossible() const {
for (int j = 0; j < taille; ++j) { for (int j = 0; j < taille; ++j) {
if (plateau[i][j] == nullptr) { if (plateau[i][j] == nullptr) {
// Si case vide // Si case vide
casesVides.push_back(std::make_pair(i, j)); casesVides.push_back({i, j});
} else { } else {
// Sinon // Sinon
if (dynamic_cast<const PieceButin *>(plateau[i][j])->getPoints() == if (dynamic_cast<const PieceButin *>(plateau[i][j])->getPoints() ==
PieceButin::Jaune) { PieceButin::Jaune) {
// Si pièce jaune // Si pièce jaune
piecesJaunes.push_back(std::make_pair(i, j)); piecesJaunes.push_back({i, j});
} }
} }
} }

View file

@ -24,5 +24,5 @@ bool Piece::isSelectionnee() const {
} }
const Position Piece::getPos() const { const Position Piece::getPos() const {
return std::make_pair(x, y); return {x, y};
} }

View file

@ -114,7 +114,7 @@ const Position Plateau::trouveCoordonnees(const int x, const int y) const {
const float tailleCelluleX = static_cast<float>(Ecran::largeur()) / taille; const float tailleCelluleX = static_cast<float>(Ecran::largeur()) / taille;
const float tailleCelluleY = static_cast<float>(Ecran::hauteur()) / taille; const float tailleCelluleY = static_cast<float>(Ecran::hauteur()) / taille;
return std::make_pair(x / tailleCelluleX, y / tailleCelluleY); return {x / tailleCelluleX, y / tailleCelluleY};
} }
int Plateau::getTaille() const { int Plateau::getTaille() const {
@ -150,8 +150,7 @@ const Position Plateau::moveSelection(const int x, const int y) {
} }
// Récupère les coordonnées // Récupère les coordonnées
const Position ancienneCoordonnees = const Position ancienneCoordonnees = {selection->x, selection->y};
std::make_pair(selection->x, selection->y);
// Retire la pièce de là où elle est pour le plateau // Retire la pièce de là où elle est pour le plateau
plateau[ancienneCoordonnees.first][ancienneCoordonnees.second] = nullptr; plateau[ancienneCoordonnees.first][ancienneCoordonnees.second] = nullptr;

View file

@ -2,8 +2,7 @@
PieceSafari::PieceSafari(const enum Categorie cat, const int posX, PieceSafari::PieceSafari(const enum Categorie cat, const int posX,
const int posY, const int pos2X, const int pos2Y) const int posY, const int pos2X, const int pos2Y)
: Piece(to_string(cat), posX, posY), _category(cat), : Piece(to_string(cat), posX, posY), _category(cat), pos2({pos2X, pos2Y}) {}
pos2(std::make_pair(pos2X, pos2Y)) {}
PieceSafari::~PieceSafari() {} PieceSafari::~PieceSafari() {}

View file

@ -222,7 +222,7 @@ Position PlateauSafari::getPlaceholderBarriere() const {
} }
void PlateauSafari::setPlaceholderBarriere(const int x, const int y) { void PlateauSafari::setPlaceholderBarriere(const int x, const int y) {
placeholderBarriere = std::make_pair(x, y); placeholderBarriere = {x, y};
} }
bool PlateauSafari::validWithPlaceholder(const int x, const int y) const { bool PlateauSafari::validWithPlaceholder(const int x, const int y) const {

View file

@ -1,5 +1,5 @@
#include "../includes/types.hpp" #include "../includes/types.hpp"
Position emptyPosition() { Position emptyPosition() {
return std::make_pair(-1, -1); return {-1, -1};
} }