Beispiel #1
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                hashCode += 1000000007 * Scale1.GetHashCode();
                hashCode += 1000000009 * CameraHeight.GetHashCode();
                hashCode += 1000000021 * CameraAngle.GetHashCode();
                hashCode += 1000000033 * Background.GetHashCode();
                hashCode += 1000000087 * FogDistance.GetHashCode();
                hashCode += 1000000093 * MaxLightStrength.GetHashCode();
                hashCode += 1000000097 * Scale2.GetHashCode();
                hashCode += 1000000103 * ViewDistance.GetHashCode();
                if (Objects != null)
                {
                    hashCode += 1000000123 * Objects.GetHashCode();
                }
                if (Floors != null)
                {
                    hashCode += 1000000181 * Floors.GetHashCode();
                }
                if (ObjectInfos != null)
                {
                    hashCode += 1000000207 * ObjectInfos.GetHashCode();
                }
                if (Walls != null)
                {
                    hashCode += 1000000223 * Walls.GetHashCode();
                }
            }
            return(hashCode);
        }
Beispiel #2
0
 // Проверка наличия объектного триплета через шкалу. Если false - точно нет, при true надо продолжать проверку
 public bool ChkOSubjPredObj0(int subj, int pred, int obj)
 {
     // Шкалу добавлю позднее
     if (false && Scale.Range > 0)
     {
         int code = Scale1.Code(Scale.Range, subj, pred, obj);
         //int word = (int)oscale.Root.Element(Scale1.GetArrIndex(code)).Get();
         //int tb = Scale1.GetFromWord(word, code);
         int tb = Scale.Scale1[code];
         if (tb == 0)
         {
             return(false);
         }
         // else if (tb == 1) return true; -- это был источник ошибки
         // else надо считаль длинно, см. далее
     }
     return(!spo_o_index.GetFirst(ent =>
     {
         int su = (int)ent.Field(0).Get();
         int cmp = su.CompareTo(subj);
         if (cmp != 0)
         {
             return cmp;
         }
         int pr = (int)ent.Field(1).Get();
         cmp = pr.CompareTo(pred);
         if (cmp != 0)
         {
             return cmp;
         }
         int ob = (int)ent.Field(2).Get();
         return ob.CompareTo(obj);
     }).IsEmpty);
     //return !spo_o_index.GetFirstByKey(new SubjPredObjInt() { subj = subj, pred = pred, obj = obj }).IsEmpty;
 }
Beispiel #3
0
        public void CreateScale()
        {
            long len = otriples.Root.Count() - 1;
            int  r   = 1;

            while (len != 0)
            {
                len = len >> 1; r++;
            }

            range = r + 4; // здесь 4 - фактор "разрежения" шкалы, можно меньше
            scale = new Scale1(range);
            foreach (object[] tr in otriples.Root.ElementValues())
            {
                int subj = (int)tr[0];
                int pred = (int)tr[1];
                int obj  = (int)tr[2];
                int code = Scale1.Code(range, subj, pred, obj);
                scale[code] = 1;
            }
        }
Beispiel #4
0
 // Проверка наличия объектного триплета через шкалу. Если false - точно нет, при true надо продолжать проверку
 public bool ChkInScale(int subj, int pred, int obj)
 {
     if (range > 0)
     {
         int code = Scale1.Code(range, subj, pred, obj);
         int bit;
         if (filescale)
         {
             int word = (int)oscale.Root.Element(Scale1.GetArrIndex(code)).Get();
             bit = Scale1.GetFromWord(word, code);
         }
         else // if (memoryscale)
         {
             bit = scale[code];
         }
         if (bit == 0)
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #5
0
 PB_Map.Image   = TerrainSprite.GetMapWithBuildings(Manager, font, Scale1, ScaleX, Map, scale, index);