diff --git a/tpl/macro.twig b/tpl/macro.twig index d5f8c65..c0b53e5 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -490,7 +490,18 @@ public class {{o.name}} : IRpc { bool is_equal = true; - $compare_fn_str + {%- if has_token(o, 'bitfields') ~%} + a.ResetFieldMask(); + {%- endif -%} + + {%- for f in o.fields ~%} + {{_self.field_compare(o, f, loop.index0)}} + {%- endfor -%} + + {%- if has_token(o, 'bitfields') ~%} + if(!is_equal) + a.SetPrimaryFieldsChanged(); + {%- endif -%} return is_equal; } @@ -501,6 +512,52 @@ public class {{o.name}} : IRpc {{has_token(u, 'bitfields')?'CompareAndMarkFields':'IsEqual'}} {% endmacro %} +{%- macro field_compare(o, f, field_idx) -%} + + {% if f.type is instanceof('\\mtgArrType') ~%} + if(a.{{f.name}} == null || + b.{{f.name}} == null || + a.{{f.name}}.Count != b.{{f.name}}.Count) + return false; + + for(int i=0;i