sanity check and error messages

This commit is contained in:
Mylloon 2023-12-27 21:39:18 +01:00
parent 7f9d100aee
commit c074ba7ae2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 7 additions and 0 deletions

View file

@ -18,6 +18,7 @@ std::string PieceButin::to_string(const enum Categorie cat) const {
return "Noire"; return "Noire";
default: default:
std::cerr << "Catégorie inconnue (PieceButin).\n";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View file

@ -55,6 +55,10 @@ bool Dames::prisePossible(Joueur &joueur) const {
int y = 1; int y = 1;
for (int i = 0; i < pieces.size(); i++) { for (int i = 0; i < pieces.size(); i++) {
PieceDames *p = dynamic_cast<PieceDames *>(pieces[i]); PieceDames *p = dynamic_cast<PieceDames *>(pieces[i]);
if (!p) {
std::cerr << "Cette pièce est.. étrange.\n";
exit(EXIT_FAILURE);
}
if (p->getDame()) { if (p->getDame()) {
// if(plateau[x][y] == nullptr) // if(plateau[x][y] == nullptr)
} }

View file

@ -23,6 +23,7 @@ std::string PieceDames::to_string(const enum Categorie cat) const {
return "Noire"; return "Noire";
default: default:
std::cerr << "Catégorie inconnue (PieceDames).\n";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View file

@ -18,6 +18,7 @@ std::string PieceSafari::to_string(const enum Categorie cat) const {
return "Lion"; return "Lion";
default: default:
std::cerr << "Catégorie inconnue (PieceSafari).\n";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }