aboutsummaryrefslogtreecommitdiff
path: root/oop1w4/Spel.cpp
blob: 5ddc35516c27565d6ca16761027439d593cc09a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "Spel.h"

Persoon* Spel::getPersoon(const std::string naam) const {
	auto iFind = scores.find(naam);
	if (iFind == scores.end())
		return nullptr;
	else
		return const_cast<Persoon*>(&iFind->first);
}

void Spel::setScore(std::string naam, int score) {
	scores[naam] = score;
}

void Spel::addScore(std::string naam, int score) {
	scores[naam] += score;
}

int Spel::getScore(std::string naam) const {
	auto iFind = scores.find(naam);
	if (iFind == scores.end())
		return 0;
	else
		return iFind->second;
}

std::map<Persoon,int>& Spel::getScores() {
	return scores;
}