diff options
Diffstat (limited to 'TileBehavior.cpp')
-rw-r--r-- | TileBehavior.cpp | 19 |
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++; } |