Esempio n. 1
0
        public virtual int CompareTo(BTriggerSystem ts, TriggerScriptDbObjectWithArgs obj)
        {
            if (Name != obj.Name)
            {
                Debug.Trace.Engine.TraceInformation(
                    "TriggerProtoDbObject: '{0}' - Encountered different names for {1}, '{2}' != '{3}'",
                    ts, this.DbId.ToString(), this.Name, obj.Name);
            }

            if (ContainsUserClassTypeVar(ts, obj))
            {
                Debug.Trace.Engine.TraceInformation(
                    "TriggerProtoDbObject: {0} - Encountered {1}/{2} which has a UserClassType Var, skipping comparison",
                    ts, DbId.ToString(), Name);
                return(0);
            }

            Contract.Assert(Version == obj.Version);
            Contract.Assert(Params.Count == obj.Args.Count);

            int diff = 0;

            for (int x = 0; x < Params.Count; x++)
            {
                int sig     = Params[x].SigID;
                int obj_sig = obj.Args[x].SigID;
                sig     = sig < 0 ? 0 : sig;
                obj_sig = obj_sig < 0 ? 0 : obj_sig;

                diff += sig - obj_sig;
            }

            return(diff);
        }
Esempio n. 2
0
        protected TriggerProtoDbObject(BTriggerSystem root, TriggerScriptDbObjectWithArgs instance)
        {
            mName = instance.Name;

            mDbId    = instance.DbId;
            mVersion = instance.Version;
            Params   = BTriggerParam.BuildDefinition(root, instance.Args);
        }
Esempio n. 3
0
 static bool ContainsUserClassTypeVar(BTriggerSystem ts, TriggerScriptDbObjectWithArgs obj)
 {
     foreach (var arg in obj.Args)
     {
         if (arg.IsInvalid)
         {
             continue;
         }
         if (arg.GetVarType(ts) == BTriggerVarType.UserClassType)
         {
             return(true);
         }
     }
     return(false);
 }