From d8289105193707daede1a5b59137f18e20f20aeb Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 18 Oct 2024 15:48:14 +0200 Subject: (2/2) rename --- TileBehavior.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'TileBehavior.cpp') 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++; } -- cgit v1.2.3