From 9f3802690f9dd9452e96d1d7a879291978d66e35 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 6 May 2021 14:13:28 -0400 Subject: Refactoring --- src/rules.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/rules.h') diff --git a/src/rules.h b/src/rules.h index f41f7ad..c1b130d 100644 --- a/src/rules.h +++ b/src/rules.h @@ -143,4 +143,11 @@ namespace rules { std::ostream& operator<<(std::ostream& os, const Ability& a); std::ostream& operator<<(std::ostream& os, const Skill& s); std::ostream& operator<<(std::ostream& os, const Qualifier& q); + + template T tryGetAbilityOrSkill(std::string src) { + try { + return T::fromString(src); + } catch(std::exception& e) {} // eat. + return T(); + } } -- cgit v1.2.3