fix barriere

This commit is contained in:
Mylloon 2024-01-07 22:02:38 +01:00
parent 17a23f4307
commit 6df2a0a12a
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -156,23 +156,22 @@ bool PlateauSafari::deplacementValide(const int x, const int y) const {
Position posInitiale = selection->getPos(); Position posInitiale = selection->getPos();
// Vérifier qu'il n'y a pas de barrière sur le chemin // Vérifier qu'il n'y a pas de barrière sur le chemin
// TODO: Ya des bugs a fix ici
for (PieceSafari *barriere : barrieres) { for (PieceSafari *barriere : barrieres) {
Position pos1 = barriere->getPos(); Position pos1 = barriere->getPos();
Position pos2 = barriere->getPos2(); Position pos2 = barriere->getPos2();
// Plus lointaine position en fonction de l'orientation // Plus lointaine position en fonction de l'orientation
PositionMutable posBarriere; // todo std::pair<float, float> posBarriere;
// Verticale // Verticale
if (pos1.first == pos2.first) { if (pos1.first == pos2.first) {
posBarriere = posBarriere =
std::make_pair(pos1.first, std::max(pos1.second, pos2.second)); std::make_pair(pos1.first, std::min(pos1.second, pos2.second) + 0.5);
} }
// Horizontale // Horizontale
else { else {
posBarriere = posBarriere =
std::make_pair(std::max(pos1.first, pos2.first), pos1.second); std::make_pair(std::min(pos1.first, pos2.first) + 0.5, pos1.second);
} }
// Vérifier les conditions pour le point posBarriere sur // Vérifier les conditions pour le point posBarriere sur