This commit is contained in:
Mylloon 2024-01-06 19:41:44 +01:00
parent 9a60ee5eb6
commit 3582844e5c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 6 additions and 5 deletions

View file

@ -33,7 +33,7 @@ void Dames::play() {
void Dames::event(const int, const int) {}
const std::pair<const int, const int> Dames::getPosition() const {
if (posCurseur.first > plateau.getTaille() - 1) {
if (posCurseur.second > plateau.getTaille() - 1) {
std::cerr << "Position inconnu du plateau.\n";
return std::make_pair(-1, -1);
}

View file

@ -119,10 +119,11 @@ Piece *Plateau::getPiece(const int x, const int y) const {
const std::pair<const int, const int>
Plateau::trouveCoordonnees(const int x, const int y) const {
const float tailleCellule = static_cast<float>(Ecran::largeur()) / taille;
const float tailleCelluleX = static_cast<float>(Ecran::largeur()) / taille;
const float tailleCelluleY = static_cast<float>(Ecran::hauteur()) / taille;
return std::make_pair(static_cast<int>(x / tailleCellule),
static_cast<int>(y / tailleCellule));
return std::make_pair(static_cast<int>(x / tailleCelluleX),
static_cast<int>(y / tailleCelluleY));
}
int Plateau::getTaille() const {

View file

@ -34,7 +34,7 @@ void Safari::play() {
void Safari::event(const int, const int) {}
const std::pair<const int, const int> Safari::getPosition() const {
if (posCurseur.first > plateau.getTaille() - 1) {
if (posCurseur.second > plateau.getTaille() - 1) {
std::cerr << "Position inconnu du plateau.\n";
return std::make_pair(-1, -1);
}