aboutsummaryrefslogtreecommitdiff
path: root/week-4/Spel.cpp
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-20 14:32:30 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-20 14:32:30 +0200
commit65a021b35340150aa6331c4b482ebfb88446be57 (patch)
treedd44675dfb118e604d6938f1f1168caed57af6ab /week-4/Spel.cpp
parentafe7337bd1230dfbed207ead0655f3b8a2362180 (diff)
week 4 huiswerk toegevoegd
Diffstat (limited to 'week-4/Spel.cpp')
-rw-r--r--week-4/Spel.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/week-4/Spel.cpp b/week-4/Spel.cpp
new file mode 100644
index 0000000..5ddc355
--- /dev/null
+++ b/week-4/Spel.cpp
@@ -0,0 +1,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;
+}