#include "TileBehavior.h" #include "Exception.h" using namespace std; TileBehaviorStrategy & TileBehavior::get_strategy(string type) { auto & type_map = TileBehavior::get_collection(); if (type_map.contains(type)) return *type_map.at(type); throw Exception("unknown behavior for tile type \"%s\"", type.c_str()); } void TileBehavior::register_strategy(string type, TileBehaviorStrategy * strategy) { auto & type_map = TileBehavior::get_collection(); type_map[type] = strategy; }