This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
DamesEtCo/src/Safari/PieceSafari.cpp

46 lines
1 KiB
C++
Raw Normal View History

#include "../../includes/Safari/PieceSafari.hpp"
2023-12-10 15:03:07 +01:00
2023-12-29 02:09:11 +01:00
PieceSafari::PieceSafari(const enum Categorie cat, const int posX,
const int posY, const int pos2X, const int pos2Y)
: Piece(to_string(cat), posX, posY), _category(cat),
pos2(std::make_pair(pos2X, pos2Y)) {}
2023-12-10 15:03:07 +01:00
PieceSafari::~PieceSafari() {}
2023-12-31 04:59:45 +01:00
const std::string PieceSafari::to_string(const enum Categorie cat) const {
switch (cat) {
case Barriere:
return "Barrière";
case Elephant:
return "Éléphant";
case Rhinoceros:
return "Rhinocéros";
case Lion:
return "Lion";
default:
throw std::logic_error("Catégorie inconnue (PieceSafari).");
}
}
2023-12-28 22:05:00 +01:00
2023-12-31 04:59:45 +01:00
const sf::Color PieceSafari::getScreenColor() const {
2023-12-28 22:05:00 +01:00
// TODO
return sf::Color::White;
}
enum PieceSafari::Categorie PieceSafari::getCategory() const {
return _category;
}
2024-01-07 02:32:26 +01:00
std::string PieceSafari::getName() const {
return categorie;
}
Position PieceSafari::getPos2() const {
if (_category != Barriere) {
throw std::logic_error("Cette pièce n'a pas de seconde position.");
}
return pos2;
}