Fixes bugs in world save (#297)
- [X] Fixes bugs in the buffer writer
- [X] Removes background save commands
- [X] Avoids calling Serialize() on deserialization
- In a future optimization I will copy the entire object to a buffer, deserialize using a SpanReader, then use that buffer for the SaveBuffer
- [X] Fixes issue with decay queue.
Bumps release version
This commit is contained in:
parent
daf48ebdf2
commit
55935d30b4
12 changed files with 122 additions and 153 deletions
|
|
@ -826,15 +826,10 @@ namespace Server
|
|||
|
||||
public int TypeRef { get; }
|
||||
|
||||
public void Serialize(DateTime serializeStart)
|
||||
public void Serialize()
|
||||
{
|
||||
if (Decays && Parent == null && Map != Map.Internal && LastMoved + DecayTime <= serializeStart)
|
||||
{
|
||||
World.EnqueueForDecay(this);
|
||||
}
|
||||
|
||||
SaveBuffer ??= new BufferWriter(true);
|
||||
SaveBuffer.Flush();
|
||||
SaveBuffer.Reset();
|
||||
Serialize(SaveBuffer);
|
||||
}
|
||||
|
||||
|
|
@ -2393,8 +2388,12 @@ namespace Server
|
|||
|
||||
public bool AtPoint(int x, int y) => m_Location.m_X == x && m_Location.m_Y == y;
|
||||
|
||||
public virtual bool CanDecay() =>
|
||||
Decays && Parent == null && Map != Map.Internal;
|
||||
|
||||
|
||||
public virtual bool OnDecay() =>
|
||||
Decays && Parent == null && Map != Map.Internal && Region.Find(Location, Map).OnDecay(this);
|
||||
CanDecay() && Region.Find(Location, Map).OnDecay(this);
|
||||
|
||||
public void SetLastMoved()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue