Example #1
0
        private readonly short[][] costs; // array is backward IDs first since get is called using the same backward ID consecutively. maybe doesn't matter.

        private ConnectionCosts()
        {
            short[][] costs = null;

            using (Stream @is = BinaryDictionary.GetTypeResource(GetType(), FILENAME_SUFFIX))
            {
                DataInput @in = new InputStreamDataInput(@is);
                CodecUtil.CheckHeader(@in, HEADER, VERSION, VERSION);
                int forwardSize  = @in.ReadVInt32();
                int backwardSize = @in.ReadVInt32();
                costs = RectangularArrays.ReturnRectangularArray <short>(backwardSize, forwardSize);
                int accum = 0;
                for (int j = 0; j < costs.Length; j++)
                {
                    short[] a = costs[j];
                    for (int i = 0; i < a.Length; i++)
                    {
                        int raw = @in.ReadVInt32();
                        accum += ((int)((uint)raw) >> 1) ^ -(raw & 1);
                        a[i]   = (short)accum;
                    }
                }
            }

            this.costs = costs;
        }
Example #2
0
        private CharacterDefinition()
        {
            using Stream @is = BinaryDictionary.GetTypeResource(GetType(), FILENAME_SUFFIX);
            DataInput @in = new InputStreamDataInput(@is);

            CodecUtil.CheckHeader(@in, HEADER, VERSION, VERSION);
            @in.ReadBytes(characterCategoryMap, 0, characterCategoryMap.Length);
            for (int i = 0; i < CLASS_COUNT; i++)
            {
                byte b = @in.ReadByte();
                invokeMap[i] = (b & 0x01) != 0;
                groupMap[i]  = (b & 0x02) != 0;
            }
        }