je comprends pas pk ca fonctionnnne pas
This commit is contained in:
parent
e7ffed3005
commit
98fceab42c
1 changed files with 23 additions and 9 deletions
|
@ -156,19 +156,33 @@ bool PlateauSafari::deplacementValideCoor(const int x1, const int y1,
|
|||
Position pos1 = barriere->getPos();
|
||||
Position pos2 = barriere->getPos2();
|
||||
|
||||
/* Conditions si vrai = bloqués */
|
||||
/* Conditions si vrai = bloqués
|
||||
* Ordre dans les vérifications :
|
||||
* - Horizontal/Vertical
|
||||
* - Sens du déplacement
|
||||
* - Barrière regardé bien sur la ligne/colonne (2 conditions)
|
||||
* - Barrière pas derrière nous
|
||||
* - Si la barrière nous bloque */
|
||||
// Gauche vers droite
|
||||
const bool gvd =
|
||||
y1 == y2 && x1 > x2 && x2 >= std::max(pos1.first, pos2.first);
|
||||
const bool gvd = y1 == y2 && x1 < x2 && y1 == pos1.second &&
|
||||
pos1.second == pos2.second &&
|
||||
x1 < std::max(pos1.first, pos2.first) &&
|
||||
x2 >= std::max(pos1.first, pos2.first);
|
||||
// Droite vers gauche
|
||||
const bool dvg =
|
||||
y1 == y2 && x1 < x2 && x2 <= std::min(pos1.first, pos2.first);
|
||||
const bool dvg = y1 == y2 && x1 > x2 && y1 == pos1.second &&
|
||||
pos1.second == pos2.second &&
|
||||
x1 > std::min(pos1.first, pos2.first) &&
|
||||
x2 <= std::min(pos1.first, pos2.first);
|
||||
// Haut vers bas / Descendre
|
||||
const bool hvb =
|
||||
x1 == x2 && y1 < y2 && y2 >= std::max(pos1.second, pos2.second);
|
||||
const bool hvb = x1 == x2 && y1 < y2 && x1 == pos1.first &&
|
||||
pos1.first == pos2.first &&
|
||||
y1 < std::max(pos1.second, pos2.second) &&
|
||||
y2 >= std::max(pos1.second, pos2.second);
|
||||
// Bas vers haut / Monter
|
||||
const bool bvh =
|
||||
x1 == x2 && y1 > y2 && y2 <= std::min(pos1.second, pos2.second);
|
||||
const bool bvh = x1 == x2 && y1 > y2 && x1 == pos1.first &&
|
||||
pos1.first == pos2.first &&
|
||||
y1 > std::min(pos1.second, pos2.second) &&
|
||||
y2 <= std::min(pos1.second, pos2.second);
|
||||
|
||||
if (d) {
|
||||
std::cout << std::boolalpha << "barriere " << pos1.first << ","
|
||||
|
|
Reference in a new issue