示例#1
0
 private Tile[] ReadLandBlock(int x, int y)
 {
     Tile[] tileArray1;
     Tile[] tileArray2;
     try
     {
         this.m_Map.Seek(((((x * this.m_BlockHeight) + y) * 196) + 4), SeekOrigin.Begin);
         tileArray1 = new Tile[64];
         try
         {
             fixed(Tile *local1 = tileArray1)
             {
             }
             TileMatrix._lread(this.m_Map.Handle, ((void *)local1), 192);
         }
         finally
         {
             local1 = ((pinned ref Tile)IntPtr.Zero);
         }
         return(tileArray1);
     }
     catch
     {
         if (DateTime.Now >= this.m_NextLandWarning)
         {
             Console.WriteLine("Warning: Land EOS for {0} ({1}, {2})", this.m_Owner, x, y);
             this.m_NextLandWarning = (DateTime.Now + TimeSpan.FromMinutes(1));
         }
         return(this.m_InvalidLandBlock);
     }
     return(tileArray2);
 }
示例#2
0
        private Tile[][][] ReadStaticBlock(int x, int y)
        {
            int num1;
            int num2;
            int num3;

            StaticTile[] tileArray1;
            int          num4;
            int          num5;

            TileList[][] listArrayArray1;
            StaticTile * tilePtr1;
            StaticTile * tilePtr2;

            Tile[][][] tileArrayArrayArray1;
            int        num6;
            int        num7;

            Tile[][][] tileArrayArrayArray2;
            try
            {
                this.m_IndexReader.BaseStream.Seek((((x * this.m_BlockHeight) + y) * 12), SeekOrigin.Begin);
                num1 = this.m_IndexReader.ReadInt32();
                num2 = this.m_IndexReader.ReadInt32();
                if ((num1 < 0) || (num2 <= 0))
                {
                    return(this.m_EmptyStaticBlock);
                }
                num3 = (num2 / 7);
                this.m_Statics.Seek(num1, SeekOrigin.Begin);
                if (TileMatrix.m_TileBuffer.Length < num3)
                {
                    TileMatrix.m_TileBuffer = new StaticTile[num3];
                }
                tileArray1 = TileMatrix.m_TileBuffer;
                try
                {
                    fixed(StaticTile *local1 = tileArray1)
                    {
                    }
                    TileMatrix._lread(this.m_Statics.Handle, ((void *)local1), num2);
                    if (TileMatrix.m_Lists == null)
                    {
                        TileMatrix.m_Lists = new TileList[8][];
                        for (num4 = 0; (num4 < 8); ++num4)
                        {
                            TileMatrix.m_Lists[num4] = new TileList[8];
                            for (num5 = 0; (num5 < 8); ++num5)
                            {
                                TileMatrix.m_Lists[num4][num5] = new TileList();
                            }
                        }
                    }
                    listArrayArray1 = TileMatrix.m_Lists;
                    tilePtr1        = local1;
                    tilePtr2        = (local1 + (num3 * sizeof(StaticTile)));
                    while ((tilePtr1 < tilePtr2))
                    {
                        listArrayArray1[(tilePtr1.m_X & 7)][(tilePtr1.m_Y & 7)].Add(((short)((tilePtr1.m_ID & 16383) + 16384)), tilePtr1.m_Z);
                        tilePtr1 += sizeof(StaticTile);
                    }
                    tileArrayArrayArray1 = new Tile[8][][];
                    for (num6 = 0; (num6 < 8); ++num6)
                    {
                        tileArrayArrayArray1[num6] = new Tile[8][];
                        for (num7 = 0; (num7 < 8); ++num7)
                        {
                            tileArrayArrayArray1[num6][num7] = listArrayArray1[num6][num7].ToArray();
                        }
                    }
                    return(tileArrayArrayArray1);
                }
                finally
                {
                    local1 = ((pinned ref StaticTile)IntPtr.Zero);
                }
            }
            catch (EndOfStreamException)
            {
                if (DateTime.Now >= this.m_NextStaticWarning)
                {
                    Console.WriteLine("Warning: Static EOS for {0} ({1}, {2})", this.m_Owner, x, y);
                    this.m_NextStaticWarning = (DateTime.Now + TimeSpan.FromMinutes(1));
                }
                return(this.m_EmptyStaticBlock);
            }
            return(tileArrayArrayArray2);
        }