aboutsummaryrefslogtreecommitdiff
path: root/src/rules.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rules.h')
-rw-r--r--src/rules.h7
1 files changed, 7 insertions, 0 deletions
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<typename T> T tryGetAbilityOrSkill(std::string src) {
+ try {
+ return T::fromString(src);
+ } catch(std::exception& e) {} // eat.
+ return T();
+ }
}