Tortues_CPP/src/Carte.cpp

58 lines
1.1 KiB
C++

#include <iostream>
#include "Carte.h"
#include "constantes.h"
#include "../include/utils.h"
using namespace std;
Carte::Carte(int couleur, int type)
{
if(couleur < 0 || couleur > 5){
exit(EXIT_FAILURE);
}
this->couleur = couleur;
this->type = type;
}
Carte::~Carte()
{
//dtor
}
string Carte::representation_type_carte(int type_carte)
{
switch (type_carte)
{
case T_PLUS1_COULEUR:
case T_PLUS1_MULTI:
return AFFICHAGE_PLUS1;
case T_PLUS2_COULEUR:
return AFFICHAGE_PLUS2;
case T_MOINS1_COULEUR:
case T_MOINS1_MULTI:
return AFFICHAGE_MOINS1;
case T_PLUS1_DERNIERE:
return AFFICHAGE_PLUS1_DERNIERE;
case T_PLUS2_DERNIERE:
return AFFICHAGE_PLUS2_DERNIERE;
}
return "";
}
void Carte::afficher(){
printf_en_couleur(this->representation_type_carte(this->getType()), this->getCouleur());
cout << endl;
}
int Carte::getType(){
return this->type;
}
int Carte::getCouleur(){
return this->couleur;
}
int Carte::deplacement_type_carte(int type_carte)
{
return type_carte % 3;
}