Exemple #1
0
        public Map(BattleField region)
        {
            this.region = region;

            FileLocation fl = FileSystem.Instance.Locate("grad.bit", GameFileLocs.Nature);

            gradMap = new BitTable(32);
            gradMap.Load(fl);

            pathFinder = new PathFinderManager(gradMap);

            fl = FileSystem.Instance.Locate("mapheight.raw", GameFileLocs.Nature);

            heightData = new ushort[HeightMapHeight][];
            ContentBinaryReader br = new ContentBinaryReader(fl);
            for (int i = 0; i < HeightMapHeight; i++)
            {
                heightData[i] = new ushort[HeightMapWidth];
                for (int j = 0; j < HeightMapWidth; j++) 
                {
                    heightData[i][j] = br.ReadUInt16();
                }
            }
            br.Close();
        }
Exemple #2
0
        public PathFinder(BitTable terr, AStarNode[][] units)
        {
            this.terrain = terr;
            this.units   = units;

            this.width  = PathFinderManager.DW;
            this.height = PathFinderManager.DH;
        }
        /// <summary>
        /// Encoding bytes to huffman algorithm.
        /// </summary>
        /// <param name="bytes"> Source bytes </param>
        /// <returns> Encoded bytes </returns>
        public static byte[] Encode(byte[] bytes)
        {
            var dictionary = BytesCalculator.Calculate(bytes);

            var header = DictionarySerializer.Serialize(dictionary);
            var body   = Encode(bytes,
                                BitTable.BuildTable(TreeBuilder.BuildTree(new TreeBuilderQueue(dictionary))));

            return(Merage(header, body));
        }
Exemple #4
0
 public PathFinderManager(BitTable terr)
 {
     terrain = terr;
     units   = new AStarNode[DW][];
     for (int i = 0; i < DW; i++)
     {
         units[i] = new AStarNode[DH];
         for (int j = 0; j < DH; j++)
         {
             units[i][j] = new AStarNode(i, j);
         }
     }
 }
Exemple #5
0
 public PathFinderManager(BitTable terr)
 {
     terrain = terr;
     units = new AStarNode[DW][];
     for (int i = 0; i < DW; i++)
     {
         units[i] = new AStarNode[DH];
         for (int j = 0; j < DH; j++)
         {
             units[i][j] = new AStarNode(i, j);
         }
     }
 }
Exemple #6
0
        public PathFinder(BitTable terr, AStarNode[][] units)
        {
            this.terrain = terr;
            this.units = units;

            this.width = PathFinderManager.DW;
            this.height = PathFinderManager.DH;
        }
Exemple #7
0
 public PathFinder(PathFinderManager mgr)
 {
     this.terrain = mgr.TerrainTable;
     this.width = mgr.Width;
     this.height = mgr.Height;
     this.units = mgr.NodeBuffer;
 }