From 2529826d7e70d67dfba945497dbe3bf216589d75 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 23 Oct 2014 15:59:01 +0100 Subject: [PATCH] Implemented message content substitution support. As in issue #202. --- src/backend/parsers.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/backend/parsers.h b/src/backend/parsers.h index 97d50972..ee0a7de9 100644 --- a/src/backend/parsers.h +++ b/src/backend/parsers.h @@ -225,6 +225,20 @@ namespace YAML { return false; } + // Make any substitutions at this point. + if (node["subs"]) { + std::vector subs = node["subs"].as>(); + for (auto& mc : content) { + boost::format f(mc.Str()); + + for (const auto& sub : subs) { + f = f % sub; + } + + mc = loot::MessageContent(f.str(), mc.Language()); + } + } + std::string condition; if (node["condition"]) condition = node["condition"].as();