Exemple #1
0
        //The start of what is now the ADT files.
        private bool LoadMapAreaChunks()
        {
            try
            {
                uint adtNumber = 0;
                foreach (var areaChunk in SMAreaChunks)
                {
                    // Has no valid adt information, move on.
                    if (areaChunk.offset == 0)
                    {
                        continue;
                    }

                    var mapArea = new CMapArea(areaChunk.offset, this, adtNumber);

                    if (mapArea.Errors)
                    {
                        return(false);
                    }

                    MapAreaChunks.Add(mapArea);
                    adtNumber++;
                }
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(false);
        }
        /// <summary>
        /// The start of what is now the ADT files.
        /// </summary>
        private bool LoadMapAreaChunks()
        {
            try
            {
                if (this.IsEOF())
                {
                    return(false);
                }

                for (uint x = 0; x < 64; x++)
                {
                    for (uint y = 0; y < 64; y++)
                    {
                        var tileBlock = TileBlocksInformation[x, y];
                        // Do we have data for this Tile?
                        if (tileBlock != null & tileBlock.size > 0)
                        {
                            // Tile should not be already occupied.
                            if (TileBlocks[x, y] != null)
                            {
                                throw new Exception("Invalid tile location.");
                            }

                            var mapArea = new CMapArea(tileBlock.offset, this, DataChunkHeader);

                            if (mapArea.Errors)
                            {
                                Logger.Warning($"[WARNING] Unable to load information for tile {x},{y}");
                                continue;
                            }

                            UsableTiles++;
                            TileBlocks[x, y] = mapArea;
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
            }

            return(false);
        }