aboutsummaryrefslogtreecommitdiff
path: root/TileBehavior.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 15:48:14 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 15:48:14 +0200
commitd8289105193707daede1a5b59137f18e20f20aeb (patch)
tree939908b9c4c6f7aaef8aa61ee2e04be3e85610b6 /TileBehavior.cpp
parent76e61d68bbf568ec0d7fc4632e52d4de5496b003 (diff)
(2/2) rename
Diffstat (limited to 'TileBehavior.cpp')
-rw-r--r--TileBehavior.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/TileBehavior.cpp b/TileBehavior.cpp
index 99301ac..9de896e 100644
--- a/TileBehavior.cpp
+++ b/TileBehavior.cpp
@@ -1,20 +1,11 @@
#include "TileBehaviorFactory.h"
-#include "Exception.h"
+#include "TileBehavior.h"
-using namespace std;
-
-TileBehavior & TileBehaviorFactory::get_strategy(string type) {
- auto & type_map = TileBehaviorFactory::get_collection();
-
- if (type_map.contains(type))
- return *type_map.at(type);
-
- throw Exception("unknown behavior for tile type \"%s\"", type.c_str());
+TileBehavior::TileBehavior(const std::string type) {
+ TileBehaviorFactory::register_strategy(type, this);
}
-void TileBehaviorFactory::register_strategy(string type, TileBehavior * strategy) {
- auto & type_map = TileBehaviorFactory::get_collection();
-
- type_map[type] = strategy;
+void TileBehavior::step(Artist *) {
+ this->interactions++;
}