This commit is contained in:
Mylloon 2024-01-08 00:41:02 +01:00
parent e1cd39438f
commit ae6fca99a4
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -32,9 +32,9 @@ void PlateauSafari::afficherPlateau(std::ostream &out, const bool d) const {
elephant.setOutlineThickness(2.); elephant.setOutlineThickness(2.);
sf::CircleShape lion(tailleCellule / 3); sf::CircleShape lion(tailleCellule / 3);
lion.setOutlineThickness(2.); lion.setOutlineThickness(2.);
sf::RectangleShape barriereH(sf::Vector2f(tailleCellule / 6, tailleCellule)); sf::RectangleShape barriereH(sf::Vector2f(tailleCellule, tailleCellule / 6));
barriereH.setFillColor(sf::Color::Black); barriereH.setFillColor(sf::Color::Black);
sf::RectangleShape barriereV(sf::Vector2f(tailleCellule, tailleCellule / 6)); sf::RectangleShape barriereV(sf::Vector2f(tailleCellule / 6, tailleCellule));
barriereV.setFillColor(sf::Color::Black); barriereV.setFillColor(sf::Color::Black);
sf::CircleShape placeholder(tailleCellule / 5); sf::CircleShape placeholder(tailleCellule / 5);
@ -117,20 +117,20 @@ void PlateauSafari::afficherPlateau(std::ostream &out, const bool d) const {
Position pos2 = it->getPos2(); Position pos2 = it->getPos2();
const float decalage = 5; const float decalage = 5;
// Verticale // Horizontale
if (pos1.first == pos2.first) { if (pos1.first == pos2.first) {
const int x = pos1.first; const int x = pos1.first;
const int y = std::max(pos1.second, pos2.second); const int y = std::max(pos1.second, pos2.second);
barriereV.setPosition(x * tailleCellule, y * tailleCellule - decalage); barriereH.setPosition(x * tailleCellule, y * tailleCellule - decalage);
Ecran::window.draw(barriereV); Ecran::window.draw(barriereH);
} }
// Horizontale // Verticale
else { else {
const int x = std::max(pos1.first, pos2.first); const int x = std::max(pos1.first, pos2.first);
const int y = pos1.second; const int y = pos1.second;
barriereH.setPosition(x * tailleCellule - decalage, y * tailleCellule); barriereV.setPosition(x * tailleCellule - decalage, y * tailleCellule);
Ecran::window.draw(barriereH); Ecran::window.draw(barriereV);
} }
} }
@ -158,12 +158,12 @@ bool PlateauSafari::deplacementValideCoor(const int x1, const int y1,
// Plus lointaine position en fonction de l'orientation // Plus lointaine position en fonction de l'orientation
std::pair<float, float> posBarriere; std::pair<float, float> posBarriere;
// Verticale // Horizontale
if (pos1.first == pos2.first) { if (pos1.first == pos2.first) {
posBarriere = posBarriere =
std::make_pair(pos1.first, std::min(pos1.second, pos2.second) + 0.5); std::make_pair(pos1.first, std::min(pos1.second, pos2.second) + 0.5);
} }
// Horizontale // Verticale
else { else {
posBarriere = posBarriere =
std::make_pair(std::min(pos1.first, pos2.first) + 0.5, pos1.second); std::make_pair(std::min(pos1.first, pos2.first) + 0.5, pos1.second);