Use KaywordParamValue objects for sanity checking reminder text scripts, this fixes:

"Error message "String param1 has no member 'value'" when using param1.value in custom keywords."

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1002 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-06-25 12:42:20 +00:00
parent ecb5477958
commit 37329ec63e
+4 -2
View File
@@ -181,8 +181,10 @@ bool KeywordReminderTextValue::checkScript(const ScriptP& script) {
Context& ctx = set.cards.empty() ? set.getContext() : set.getContext(set.cards.front());
LocalScope scope(ctx);
for (size_t i = 0 ; i < keyword.parameters.size() ; ++i) {
String param = String(_("param")) << (int)(i+1);
ctx.setVariable(param, to_script(param));
const KeywordParam& kwp = *keyword.parameters[i];
String param_name = String(_("param")) << (int)(i+1);
String param_value = _("<atom-kwpph>") + (kwp.placeholder.empty() ? kwp.name : kwp.placeholder) + _("</atom-kwpph>");
ctx.setVariable(param_name, new_intrusive4<KeywordParamValue>(kwp.name, _(""), _(""), param_value));
}
script->eval(ctx);
errors.clear();