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
|
|
@ -44,9 +44,6 @@ namespace Server.Commands
|
|||
Register("Help", AccessLevel.Player, Help_OnCommand);
|
||||
|
||||
Register("Save", AccessLevel.Administrator, Save_OnCommand);
|
||||
Register("BackgroundSave", AccessLevel.Administrator, BackgroundSave_OnCommand);
|
||||
Register("BGSave", AccessLevel.Administrator, BackgroundSave_OnCommand);
|
||||
Register("SaveBG", AccessLevel.Administrator, BackgroundSave_OnCommand);
|
||||
|
||||
Register("Move", AccessLevel.GameMaster, Move_OnCommand);
|
||||
Register("Client", AccessLevel.Counselor, Client_OnCommand);
|
||||
|
|
@ -482,20 +479,9 @@ namespace Server.Commands
|
|||
AutoSave.Save();
|
||||
}
|
||||
|
||||
[Usage("BackgroundSave")]
|
||||
[Aliases("BGSave", "SaveBG")]
|
||||
[Description("Saves the world, writing to the disk in the background")]
|
||||
private static void BackgroundSave_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
AutoSave.Save(true);
|
||||
}
|
||||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Item item) => map != null && map != Map.Internal ||
|
||||
item.RootParent is Mobile m && FixMap(
|
||||
ref map,
|
||||
ref loc,
|
||||
m
|
||||
);
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Item item) =>
|
||||
map != null && map != Map.Internal || item.RootParent is Mobile m &&
|
||||
FixMap(ref map, ref loc, m);
|
||||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Mobile m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Server.Misc
|
|||
|
||||
if (m_Warning == TimeSpan.Zero)
|
||||
{
|
||||
Save(true);
|
||||
Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -85,12 +85,7 @@ namespace Server.Misc
|
|||
|
||||
public static void Save()
|
||||
{
|
||||
Save(false);
|
||||
}
|
||||
|
||||
public static void Save(bool permitBackgroundWrite)
|
||||
{
|
||||
if (AutoRestart.Restarting)
|
||||
if (AutoRestart.Restarting || !World.Running)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -118,10 +113,7 @@ namespace Server.Misc
|
|||
|
||||
var root = Path.Combine(Core.BaseDirectory, "Backups/Automatic");
|
||||
|
||||
if (!Directory.Exists(root))
|
||||
{
|
||||
Directory.CreateDirectory(root);
|
||||
}
|
||||
AssemblyHandler.EnsureDirectory(root);
|
||||
|
||||
var existing = Directory.GetDirectories(root);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue