Esempio n. 1
0
        private void OpTo(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
        {
            result.Clear();
            long min = (lf.vtype == QuestTCPVType.vtExt) ? (long)Math.Round(lf.vf) : lf.vd.GetMinimun();
            long max = (rf.vtype == QuestTCPVType.vtExt) ? (long)Math.Round(rf.vf) : rf.vd.GetMaximun();

            result.vtype = QuestTCPVType.vtRange;
            result.vd.Add(min, max);
        }
Esempio n. 2
0
        private void OpDiv(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
        {
            result.Clear();
            double l = lf.GetValue();
            double r = rf.GetValue();

            if (r == 0)
            {
                result.vf = (l < 0) ? -2000000000 : 2000000000;
            }
            else
            {
                result.vf = l / r;
            }
        }
Esempio n. 3
0
 private void OpIn(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
 {
     result.Clear();
     if ((lf.vtype == QuestTCPVType.vtExt) && (rf.vtype == QuestTCPVType.vtExt))
     {
         result.vf = lf.vf == rf.vf ? 1 : 0;
     }
     else if ((lf.vtype == QuestTCPVType.vtRange) && (rf.vtype == QuestTCPVType.vtExt))
     {
         result.vf = lf.vd.Have(rf.vf) ? 1 : 0;
     }
     else if ((lf.vtype == QuestTCPVType.vtExt) && (rf.vtype == QuestTCPVType.vtRange))
     {
         result.vf = rf.vd.Have(lf.vf) ? 1 : 0;
     }
     else if ((lf.vtype == QuestTCPVType.vtRange) && (rf.vtype == QuestTCPVType.vtRange))
     {
         result.vf = rf.vd.Have(lf.GetValue()) ? 1 : 0;
     }
 }
Esempio n. 4
0
        private void OpMod(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
        {
            result.Clear();
            double l = lf.GetValue();
            double r = rf.GetValue();

            r = Math.Truncate(r);
            if (r == 0)
            {
                result.vf = (l < 0) ? -2000000000 : 2000000000;
            }
            else
            {
                r = (r < 0) ? -r: r;
                bool ldz = l < 0;
                l         = ldz ? -l : l;
                result.vf = Math.Truncate(l - r * Math.Truncate(l / r));
                result.vf = ldz ? -result.vf : result.vf;
            }
        }
Esempio n. 5
0
 private void OpOr(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
 {
     result.Clear();
     if ((lf.vtype == QuestTCPVType.vtExt) && (rf.vtype == QuestTCPVType.vtExt))
     {
         result.vf = (lf.vf != 0) || (rf.vf != 0) ? 1 : 0;
     }
     else if ((lf.vtype == QuestTCPVType.vtRange) && (rf.vtype == QuestTCPVType.vtRange))
     {
         result.CopyDataFrom(lf);
         result.vd.Add(rf.vd);
     }
     else if ((lf.vtype == QuestTCPVType.vtExt) && (rf.vtype == QuestTCPVType.vtRange))
     {
         result.CopyDataFrom(rf);
         result.vd.Add(lf.vf);
     }
     else if ((lf.vtype == QuestTCPVType.vtRange) && (rf.vtype == QuestTCPVType.vtExt))
     {
         result.CopyDataFrom(lf);
         result.vd.Add(rf.vf);
     }
 }
Esempio n. 6
0
 private void OpNotEq(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
 {
     result.Clear();
     result.vf = lf.GetValue() != rf.GetValue() ? 1 : 0;
 }
Esempio n. 7
0
 private void OpMul(QuestTCPVariant lf, QuestTCPVariant rf, ref QuestTCPVariant result)
 {
     result.Clear();
     result.vf = lf.GetValue() * rf.GetValue();
 }