You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
#include "joueur.hpp"
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
namespace jeu {
|
|
int Joueur::numJoueur = 0;
|
|
|
|
Joueur::Joueur(string nom)
|
|
:nom{nom}, scoreTotal{0}, scoreCourant{0}
|
|
{}
|
|
|
|
Joueur::Joueur()
|
|
:Joueur{"Joueur" + to_string(numJoueur+1)}
|
|
{}
|
|
|
|
string Joueur::getNom() const {
|
|
return nom;
|
|
}
|
|
|
|
int Joueur::getScoreCourant() const{
|
|
return scoreCourant;
|
|
}
|
|
|
|
int Joueur::getScoreTotal() const{
|
|
return scoreTotal;
|
|
}
|
|
|
|
void Joueur::ajouterAuScoreCourant(int delta) {
|
|
scoreCourant += delta;
|
|
}
|
|
|
|
void Joueur::effacerScoreCourant() {
|
|
scoreCourant = 0;
|
|
}
|
|
|
|
void Joueur::ajouterAuScoreTotal(int delta) {
|
|
scoreTotal += delta;
|
|
}
|
|
void Joueur::effacerScores() {
|
|
scoreTotal = 0;
|
|
}
|
|
} // fin du namspace jeu
|
|
|
|
ostream &operator<<(ostream &s, const jeu::Joueur &j) {
|
|
s << "Le joueur " << j.getNom() << " possede un score courant de " << j.getScoreCourant() << " et un score de " << j.getScoreTotal() << endl;
|
|
return s;
|
|
} |