fix(codegen): Adds manual dirty checking (#621)
- Adds `[ManualDirtyChecking]` for anyone that adds it themselves. - Adds detection of `[Serializable]` and `[ManualDirtyChecking]` at startup to help identify scripts that need migration.
This commit is contained in:
parent
90dc5e742c
commit
81e4087acc
10 changed files with 79 additions and 53 deletions
|
|
@ -20,10 +20,6 @@ namespace Server
|
|||
{
|
||||
public interface ISerializable
|
||||
{
|
||||
// Make sure all properties that will be serialized are calling `MarkDirty()` when they get modified.
|
||||
// This should be done manually or via code gen through SerializedField attribute.
|
||||
// This attribute should be virtual for any base serializalbe type (Item, Mobile, etc) that can be opt-in per type.
|
||||
bool UseDirtyChecking { get; }
|
||||
long SavePosition { get; protected set; }
|
||||
BufferWriter SaveBuffer { get; protected internal set; }
|
||||
int TypeRef { get; }
|
||||
|
|
@ -43,7 +39,7 @@ namespace Server
|
|||
public void InitializeSaveBuffer(byte[] buffer)
|
||||
{
|
||||
SaveBuffer = new BufferWriter(buffer, true);
|
||||
if (UseDirtyChecking)
|
||||
if (World.DirtyTrackingEnabled)
|
||||
{
|
||||
SavePosition = SaveBuffer.Position;
|
||||
}
|
||||
|
|
@ -67,7 +63,7 @@ namespace Server
|
|||
SaveBuffer.Seek(0, SeekOrigin.Begin);
|
||||
Serialize(SaveBuffer);
|
||||
|
||||
if (UseDirtyChecking)
|
||||
if (World.DirtyTrackingEnabled)
|
||||
{
|
||||
SavePosition = SaveBuffer.Position;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue