Fixed issue with decay erroneously triggering world save warnings.
This commit is contained in:
parent
0c7efa2419
commit
5be90584b6
4 changed files with 32 additions and 20 deletions
|
|
@ -34,7 +34,10 @@ namespace Server {
|
|||
get { return "Standard"; }
|
||||
}
|
||||
|
||||
private Queue<Item> _decayQueue;
|
||||
|
||||
public StandardSaveStrategy() {
|
||||
_decayQueue = new Queue<Item>();
|
||||
}
|
||||
|
||||
public override void Save( SaveMetrics metrics ) {
|
||||
|
|
@ -109,8 +112,9 @@ namespace Server {
|
|||
|
||||
idx.Write( ( int ) items.Count );
|
||||
foreach ( Item item in items.Values ) {
|
||||
if ( item.Decays && item.Parent == null && item.Map != Map.Internal && ( item.LastMoved + item.DecayTime ) <= DateTime.Now )
|
||||
decaying.Add( item );
|
||||
if ( item.Decays && item.Parent == null && item.Map != Map.Internal && ( item.LastMoved + item.DecayTime ) <= DateTime.Now ) {
|
||||
_decayQueue.Enqueue( item );
|
||||
}
|
||||
|
||||
long start = bin.Position;
|
||||
|
||||
|
|
@ -136,13 +140,6 @@ namespace Server {
|
|||
idx.Close();
|
||||
tdb.Close();
|
||||
bin.Close();
|
||||
|
||||
for ( int i = 0; i < decaying.Count; ++i ) {
|
||||
Item item = decaying[i];
|
||||
|
||||
if ( item.OnDecay() )
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveGuilds( SaveMetrics metrics ) {
|
||||
|
|
@ -177,5 +174,15 @@ namespace Server {
|
|||
idx.Close();
|
||||
bin.Close();
|
||||
}
|
||||
|
||||
public override void ProcessDecay() {
|
||||
while ( _decayQueue.Count > 0 ) {
|
||||
Item item = _decayQueue.Dequeue();
|
||||
|
||||
if ( item.OnDecay() ) {
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue