aboutsummaryrefslogtreecommitdiff
path: root/oop1w4/Spel.cpp
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-11-09 11:48:12 +0100
committerlonkaars <loek@pipeframe.xyz>2022-11-09 11:48:12 +0100
commitffae2cb77bfb3263146a2de0deedf6528d4df461 (patch)
tree88e4b61087069f8ce5badadbc6264d20b8a051d5 /oop1w4/Spel.cpp
parentd797758769d033c64babdf77ea6b64262f792b23 (diff)
repository aanpassen voor oop2
Diffstat (limited to 'oop1w4/Spel.cpp')
-rw-r--r--oop1w4/Spel.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/oop1w4/Spel.cpp b/oop1w4/Spel.cpp
new file mode 100644
index 0000000..5ddc355
--- /dev/null
+++ b/oop1w4/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;
+}