Ultima.Map.ResetCache C# (CSharp) Method

ResetCache() public method

public ResetCache ( ) : void
return void
        public void ResetCache()
        {
            m_Cache = null;
            m_Cache_NoPatch = null;
            m_Cache_NoStatics = null;
            m_Cache_NoStatics_NoPatch = null;
            IsCached_Default = false;
            IsCached_NoStatics = false;
            IsCached_NoPatch = false;
            IsCached_NoStatics_NoPatch = false;
        }

Usage Example

Esempio n. 1
0
        private void StaticImport(string filename)
        {
            StreamReader ip = new StreamReader(filename);

            string     line;
            StaticTile newTile = new StaticTile
            {
                m_ID  = 0xFFFF,
                m_Hue = 0
            };
            int blockY;
            int blockX = blockY = 0;

            while ((line = ip.ReadLine()) != null)
            {
                if ((line = line.Trim()).Length == 0 || line.StartsWith("#") || line.StartsWith("//"))
                {
                    continue;
                }

                try
                {
                    if (line.StartsWith("SECTION WORLDITEM"))
                    {
                        if (newTile.m_ID != 0xFFFF)
                        {
                            _currMap.Tiles.AddPendingStatic(blockX, blockY, newTile);
                            blockX = blockY = 0;
                        }
                        newTile = new StaticTile
                        {
                            m_ID  = 0xFFFF,
                            m_Hue = 0
                        };
                    }
                    else if (line.StartsWith("ID"))
                    {
                        line         = line.Remove(0, 2);
                        line         = line.TrimStart(' ');
                        line         = line.TrimEnd(' ');
                        newTile.m_ID = Art.GetLegalItemID(Convert.ToUInt16(line));
                    }
                    else if (line.StartsWith("X"))
                    {
                        line = line.Remove(0, 1);
                        line = line.TrimStart(' ');
                        line = line.TrimEnd(' ');
                        int x = Convert.ToInt32(line);
                        blockX      = x >> 3;
                        x          &= 0x7;
                        newTile.m_X = (byte)x;
                    }
                    else if (line.StartsWith("Y"))
                    {
                        line = line.Remove(0, 1);
                        line = line.TrimStart(' ');
                        line = line.TrimEnd(' ');
                        int y = Convert.ToInt32(line);
                        blockY      = y >> 3;
                        y          &= 0x7;
                        newTile.m_Y = (byte)y;
                    }
                    else if (line.StartsWith("Z"))
                    {
                        line        = line.Remove(0, 1);
                        line        = line.TrimStart(' ');
                        line        = line.TrimEnd(' ');
                        newTile.m_Z = Convert.ToSByte(line);
                    }
                    else if (line.StartsWith("COLOR"))
                    {
                        line          = line.Remove(0, 5);
                        line          = line.TrimStart(' ');
                        line          = line.TrimEnd(' ');
                        newTile.m_Hue = Convert.ToInt16(line);
                    }
                }
                catch
                {
                    // ignored
                }
            }
            if (newTile.m_ID != 0xFFFF)
            {
                _currMap.Tiles.AddPendingStatic(blockX, blockY, newTile);
            }

            ip.Close();

            MessageBox.Show("Done", "Freeze Static", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            _currMap.ResetCache();
            pictureBox.Invalidate();
        }