EnumReader now warns about the correct string,

parse_enum function throws if the string can not be parsed

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1341 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2009-01-11 00:45:21 +00:00
parent 8c1cf2a0a6
commit c8dd777bca
5 changed files with 24 additions and 15 deletions
+3 -7
View File
@@ -21,7 +21,7 @@
DECLARE_TYPEOF_COLLECTION(SymbolVariationP);
bool parse_enum(const String&, ImageCombine& out);
void parse_enum(const String&, ImageCombine& out);
// ----------------------------------------------------------------------------- : Utility
@@ -56,9 +56,7 @@ SCRIPT_FUNCTION(combine_blend) {
SCRIPT_PARAM(GeneratedImageP, image1);
SCRIPT_PARAM(GeneratedImageP, image2);
ImageCombine image_combine;
if (!parse_enum(combine, image_combine)) {
throw ScriptError(_("Not a valid combine mode: '") + combine + _("'"));
}
parse_enum(combine, image_combine);
return new_intrusive3<CombineBlendImage>(image1, image2, image_combine);
}
@@ -78,9 +76,7 @@ SCRIPT_FUNCTION(set_combine) {
SCRIPT_PARAM(String, combine);
SCRIPT_PARAM_C(GeneratedImageP, input);
ImageCombine image_combine;
if (!parse_enum(combine, image_combine)) {
throw ScriptError(_("Not a valid combine mode: '") + combine + _("'"));
}
parse_enum(combine, image_combine);
return new_intrusive2<SetCombineImage>(input, image_combine);
}