aboutsummaryrefslogtreecommitdiff
path: root/src/rules.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-06 14:13:28 -0400
committerYour Name <you@example.com>2021-05-06 14:13:28 -0400
commit9f3802690f9dd9452e96d1d7a879291978d66e35 (patch)
tree6d6c17b39abdb9490119241bc4fc061744b46d7d /src/rules.h
parent2a9f262e6db5906db445d465e500d7ba8c90fab3 (diff)
downloaddmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.tar.gz
dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.tar.bz2
dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.zip
Refactoring
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();
+ }
}