Server.Mobiles.Spawner.Defrag C# (CSharp) Méthode

Defrag() public méthode

public Defrag ( ) : void
Résultat void
		public void Defrag()
		{
			bool removed = false;

			for ( int i = 0; i < m_Spawned.Count; ++i )
			{
				ISpawnable e = m_Spawned[i];

				bool toRemove = false;

				if( e is Item )
				{
					Item item = (Item)e;

					if (item.Deleted || item.Parent != null)
						toRemove = true;
				}
				else if (e is Mobile)
				{
					Mobile m = (Mobile)e;

					if (m.Deleted)
					{
						toRemove = true;
					}
					else if (m is BaseCreature)
					{
						BaseCreature bc = (BaseCreature)m;

						if (bc.Controlled || bc.IsStabled)
						{
							toRemove = true;
						}
					}
				}

				if (toRemove)
				{
					m_Spawned.RemoveAt(i);
					--i;
					removed = true;
				}
			}

			if ( removed )
				InvalidateProperties();
		}