Resolve: Damage can potentially modify the collection during the enumeration.
This commit is contained in:
parent
1a6504a803
commit
b54bf2c8bb
2 changed files with 18 additions and 8 deletions
|
|
@ -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] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue