Пример #1
0
        public void SaveMasked(BinaryWriter writer)
        {
            List <MiddleMap> list = Calc(out List <HighMap> hiList);

            writer.Write((ushort)hiList.Count);
            writer.Write((ushort)list.Count);
            for (int i = 0; i < _highMap.Length; i++)
            {
                writer.Write((ushort)(_highMap[i].Index * 16));
            }
            for (int i = 0; i < hiList.Count; i++)
            {
                var mid = hiList[i].Map;
                for (int j = 0; j < 16; j++)
                {
                    writer.Write((ushort)(mid[j].Index * 16));
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                MiddleMap middle = list[i];
                int[]     mid    = middle.Map;
                writer.Write((ushort)middle.Mask);
                Debug.WriteLine($"mid {i}:{(ushort)middle.Mask:X4}");
                for (int j = 0; j < 16; j++)
                {
                    writer.Write((ushort)mid[j]);
                }
            }
        }
Пример #2
0
 public HighMap()
 {
     Map = new MiddleMap[16];
     for (int i = 0; i < Map.Length; i++)
     {
         Map[i] = new MiddleMap();
     }
 }
Пример #3
0
            public bool Equals(MiddleMap other)
            {
                for (int i = 0; i < Map.Length; i++)
                {
                    if (other.Map[i] != Map[i])
                    {
                        return(false);
                    }
                }

                return(true);
            }
Пример #4
0
        private MiddleMap SetSlot(char wch, int diff)
        {
            if (diff > _maxOffset)
            {
                _maxOffset = diff;
            }

            if (diff < _minOffset)
            {
                _minOffset = diff;
            }
            HighMap   high = _highMap[wch >> 8];
            MiddleMap mid  = high.Map[(wch >> 4) & 0xf];

            mid.Map[wch & 0xf] = diff;
            return(mid);
        }