From a00d901671e13bbc64214cc4984167f6a6d8280b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 11 Jan 2024 19:37:39 +0100 Subject: [PATCH] pair madness --- src/Butin/Butin.cpp | 2 +- src/Butin/PlateauButin.cpp | 4 ++-- src/Piece.cpp | 2 +- src/Plateau.cpp | 5 ++--- src/Safari/PieceSafari.cpp | 3 +-- src/Safari/PlateauSafari.cpp | 2 +- src/types.cpp | 2 +- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Butin/Butin.cpp b/src/Butin/Butin.cpp index 946f185..0f3016b 100644 --- a/src/Butin/Butin.cpp +++ b/src/Butin/Butin.cpp @@ -209,5 +209,5 @@ Position Butin::calculpoints(const bool end) const { } } - return std::make_pair(j1, j2); + return {j1, j2}; } diff --git a/src/Butin/PlateauButin.cpp b/src/Butin/PlateauButin.cpp index 3970ae7..82337b8 100644 --- a/src/Butin/PlateauButin.cpp +++ b/src/Butin/PlateauButin.cpp @@ -111,13 +111,13 @@ bool PlateauButin::coupsPossible() const { for (int j = 0; j < taille; ++j) { if (plateau[i][j] == nullptr) { // Si case vide - casesVides.push_back(std::make_pair(i, j)); + casesVides.push_back({i, j}); } else { // Sinon if (dynamic_cast(plateau[i][j])->getPoints() == PieceButin::Jaune) { // Si pièce jaune - piecesJaunes.push_back(std::make_pair(i, j)); + piecesJaunes.push_back({i, j}); } } } diff --git a/src/Piece.cpp b/src/Piece.cpp index 6d54ae8..730fa43 100644 --- a/src/Piece.cpp +++ b/src/Piece.cpp @@ -24,5 +24,5 @@ bool Piece::isSelectionnee() const { } const Position Piece::getPos() const { - return std::make_pair(x, y); + return {x, y}; } diff --git a/src/Plateau.cpp b/src/Plateau.cpp index 7d41de5..1ab5d99 100644 --- a/src/Plateau.cpp +++ b/src/Plateau.cpp @@ -114,7 +114,7 @@ const Position Plateau::trouveCoordonnees(const int x, const int y) const { const float tailleCelluleX = static_cast(Ecran::largeur()) / taille; const float tailleCelluleY = static_cast(Ecran::hauteur()) / taille; - return std::make_pair(x / tailleCelluleX, y / tailleCelluleY); + return {x / tailleCelluleX, y / tailleCelluleY}; } int Plateau::getTaille() const { @@ -150,8 +150,7 @@ const Position Plateau::moveSelection(const int x, const int y) { } // Récupère les coordonnées - const Position ancienneCoordonnees = - std::make_pair(selection->x, selection->y); + const Position ancienneCoordonnees = {selection->x, selection->y}; // Retire la pièce de là où elle est pour le plateau plateau[ancienneCoordonnees.first][ancienneCoordonnees.second] = nullptr; diff --git a/src/Safari/PieceSafari.cpp b/src/Safari/PieceSafari.cpp index 3ebad5e..18ee137 100644 --- a/src/Safari/PieceSafari.cpp +++ b/src/Safari/PieceSafari.cpp @@ -2,8 +2,7 @@ PieceSafari::PieceSafari(const enum Categorie cat, const int posX, const int posY, const int pos2X, const int pos2Y) - : Piece(to_string(cat), posX, posY), _category(cat), - pos2(std::make_pair(pos2X, pos2Y)) {} + : Piece(to_string(cat), posX, posY), _category(cat), pos2({pos2X, pos2Y}) {} PieceSafari::~PieceSafari() {} diff --git a/src/Safari/PlateauSafari.cpp b/src/Safari/PlateauSafari.cpp index 768fee0..88430e9 100644 --- a/src/Safari/PlateauSafari.cpp +++ b/src/Safari/PlateauSafari.cpp @@ -222,7 +222,7 @@ Position PlateauSafari::getPlaceholderBarriere() const { } 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 { diff --git a/src/types.cpp b/src/types.cpp index 0aa1a78..8f36012 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1,5 +1,5 @@ #include "../includes/types.hpp" Position emptyPosition() { - return std::make_pair(-1, -1); + return {-1, -1}; }