debug
This commit is contained in:
parent
6c86e96097
commit
8de0dc19dd
1 changed files with 12 additions and 15 deletions
|
@ -156,26 +156,23 @@ bool PlateauSafari::deplacementValideCoor(const int x1, const int y1,
|
|||
Position pos1 = barriere->getPos();
|
||||
Position pos2 = barriere->getPos2();
|
||||
|
||||
// Gauche vers droite
|
||||
const bool gvd = std::max(pos1.first, pos2.first) >= std::max(x1, x2);
|
||||
// Droite vers gauche
|
||||
const bool dvg = std::min(pos1.first, pos2.first) <= std::min(x1, x2);
|
||||
// Haut vers bas / Descendre
|
||||
const bool hvb = std::max(pos1.second, pos2.second) >= std::max(y1, y2);
|
||||
// Bas vers haut / Monter
|
||||
const bool bvh = std::min(pos1.second, pos2.second) <= std::min(y1, y2);
|
||||
|
||||
if (d) {
|
||||
std::cout << std::boolalpha << "barriere" << pos1.first << ","
|
||||
<< pos1.second << "|" << pos2.first << "," << pos2.second
|
||||
<< " et pieces" << x1 << "," << y1 << "|" << x2 << "," << y2
|
||||
<< "=> "
|
||||
<< (std::max(pos1.first, pos2.first) >= std::max(x1, x2)) << " "
|
||||
<< (std::min(pos1.first, pos2.first) <= std::min(x1, x2)) << " "
|
||||
<< (std::max(pos1.second, pos2.second) >= std::max(y1, y2))
|
||||
<< " "
|
||||
<< (std::min(pos1.second, pos2.second) <= std::min(y1, y2))
|
||||
<< " " << std::endl;
|
||||
<< "=> " << gvd << " " << dvg << " " << hvb << " " << bvh << " "
|
||||
<< std::endl;
|
||||
}
|
||||
if ( // Gauche vers droite
|
||||
std::max(pos1.first, pos2.first) >= std::max(x1, x2)
|
||||
// Droite vers gauche
|
||||
&& std::min(pos1.first, pos2.first) <= std::min(x1, x2)
|
||||
// Haut vers bas / Descendre
|
||||
&& std::max(pos1.second, pos2.second) >= std::max(y1, y2)
|
||||
// Bas vers haut / Monter
|
||||
&& std::min(pos1.second, pos2.second) <= std::min(y1, y2)) {
|
||||
if (gvd && dvg && hvb && bvh) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue