Resolve: Damage can potentially modify the collection during the enumeration.

This commit is contained in:
mark 2009-10-27 04:32:03 +00:00
parent 1a6504a803
commit b54bf2c8bb
2 changed files with 18 additions and 8 deletions

View file

@ -47,23 +47,28 @@ namespace Server.Items
DateTime now = DateTime.Now;
TimeSpan age = now - m_Created;
if( age > m_Duration )
if( age > m_Duration ) {
Delete();
else
{
} else {
if( !m_Drying && age > (m_Duration - age) )
{
m_Drying = true;
ItemID = 0x122B;
}
List<Mobile> toDamage = new List<Mobile>();
foreach( Mobile m in GetMobilesInRange( 0 ) )
{
BaseCreature bc = m as BaseCreature;
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
{
Damage ( m );
toDamage.Add( m );
}
}
for ( int i = 0; i < toDamage.Count; i++ )
Damage( toDamage[i] );
}
}

View file

@ -49,24 +49,29 @@ namespace Server.Items
DateTime now = DateTime.Now;
TimeSpan age = now - m_Created;
if( age > m_Duration )
if( age > m_Duration ) {
Delete();
else
{
} else {
if( !m_Drying && age > (m_Duration - age) )
{
m_Drying = true;
ItemID = 0x122B;
}
List<Mobile> toDamage = new List<Mobile>();
foreach( Mobile m in GetMobilesInRange( 0 ) )
{
BaseCreature bc = m as BaseCreature;
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
{
Damage ( m );
toDamage.Add( m );
}
}
for ( int i = 0; i < toDamage.Count; i++ )
Damage( toDamage[i] );
}
}
public override bool OnMoveOver( Mobile m )