aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/SaveSystem.cs
diff options
context:
space:
mode:
authorRogueAI42 <[email protected]>2017-06-12 22:38:53 +1000
committerRogueAI42 <[email protected]>2017-06-12 22:38:53 +1000
commit388835c96a1ace2fc8f317ecb10981da76aeac05 (patch)
tree2dbc60cd65a0a2cd041c052c152070cf99246096 /ShiftOS_TheReturn/SaveSystem.cs
parentc0017e35a46eb20e7ba2717009171eedaf9785e7 (diff)
downloadshiftos_thereturn-388835c96a1ace2fc8f317ecb10981da76aeac05.tar.gz
shiftos_thereturn-388835c96a1ace2fc8f317ecb10981da76aeac05.tar.bz2
shiftos_thereturn-388835c96a1ace2fc8f317ecb10981da76aeac05.zip
fixed ShiftFS save
simple
Diffstat (limited to 'ShiftOS_TheReturn/SaveSystem.cs')
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs73
1 files changed, 32 insertions, 41 deletions
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index a4e79a7..a3a992c 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -163,29 +163,22 @@ namespace ShiftOS.Engine
bool guidReceived = false;
ServerManager.GUIDReceived += (str) =>
{
- //Connection successful! Stop waiting!
- guidReceived = true;
+ //Connection successful! Stop waiting!
+ guidReceived = true;
Console.WriteLine("[inetd] Connection successful.");
};
try
{
- if (ServerManager.ServerOnline)
- {
- ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort);
- //This haults the client until the connection is successful.
- while (ServerManager.thisGuid == new Guid())
- {
- Thread.Sleep(10);
- }
- Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
- FinishBootstrap();
- }
- else
+
+ ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort);
+ //This haults the client until the connection is successful.
+ while (ServerManager.thisGuid == new Guid())
{
- Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection.");
- FinishBootstrap();
+ Thread.Sleep(10);
}
+ Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
+ FinishBootstrap();
}
catch (Exception ex)
{
@@ -527,10 +520,8 @@ namespace ShiftOS.Engine
{
try
{
- if (Story.Context == null)
- {
- Story.Start(CurrentSave.PickupPoint);
- }
+ Story.Start(CurrentSave.PickupPoint);
+ TerminalBackend.PrintPrompt();
}
catch { }
}
@@ -637,40 +628,40 @@ namespace ShiftOS.Engine
/// </summary>
public static void SaveGame()
{
- if (IsSandbox == false)
- {
#if !NOSAVE
- if (!Shiftorium.Silent)
- Console.WriteLine("");
- if (!Shiftorium.Silent)
- Console.Write("{SE_SAVING}... ");
- if (SaveSystem.CurrentSave != null)
+ if (!IsSandbox)
{
- var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented);
- new Thread(() =>
+ if (!Shiftorium.Silent)
+ Console.WriteLine("");
+ if (!Shiftorium.Silent)
+ Console.Write("{SE_SAVING}... ");
+ if (SaveSystem.CurrentSave != null)
{
- try
+ var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented);
+ new Thread(() =>
{
+ try
+ {
// please don't do networking on the main thread if you're just going to
// discard the response, it's extremely slow
ServerManager.SendMessage("mud_save", serialisedSaveFile);
+ }
+ catch { }
+ })
+ { IsBackground = false }.Start();
+ if (!System.IO.Directory.Exists(Paths.SaveDirectory))
+ {
+ System.IO.Directory.CreateDirectory(Paths.SaveDirectory);
+
}
- catch { }
- })
- { IsBackground = false }.Start();
- if (!System.IO.Directory.Exists(Paths.SaveDirectory))
- {
- System.IO.Directory.CreateDirectory(Paths.SaveDirectory);
+ System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile);
}
-
- System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile);
+ if (!Shiftorium.Silent)
+ Console.WriteLine(" ...{DONE}.");
}
- if (!Shiftorium.Silent)
- Console.WriteLine(" ...{DONE}.");
System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0));
#endif
- }
}
/// <summary>