Exemplo n.º 1
0
        public XCMapFile(
            string baseName,
            string basePath,
            string blankPath,
            List <TileBase> tiles,
            string[] depList,
            RmpFile rmp)
            :
            base(baseName, tiles)
        {
            BaseName      = baseName;
            BasePath      = basePath;
            _blankPath    = blankPath;
            _dependencies = depList;
            Rmp           = rmp;

            var filePath = basePath + baseName + ".MAP";

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(filePath);
            }

            for (int i = 0; i < tiles.Count; i++)
            {
                tiles[i].MapId = i;
            }

            ReadMap(File.OpenRead(filePath), tiles);

            SetupRoutes(rmp);

            if (File.Exists(blankPath + baseName + BlankFile.Extension))
            {
                try
                {
                    BlankFile.LoadBlanks(baseName, blankPath, this);
                }
                catch
                {
                    for (int h = 0; h < MapSize.Height; h++)
                    {
                        for (int r = 0; r < MapSize.Rows; r++)
                        {
                            for (int c = 0; c < MapSize.Cols; c++)
                            {
                                this[r, c, h].DrawAbove = true;
                            }
                        }
                    }
                }
            }
            else if (!string.IsNullOrEmpty(blankPath))
            {
                CalcDrawAbove();
                SaveBlanks();
            }
        }
Exemplo n.º 2
0
 public void SaveBlanks()
 {
     BlankFile.SaveBlanks(BaseName, _blankPath, this);
 }