1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Fix loading saves

This commit is contained in:
Starbeamrainbowlabs 2017-10-23 19:51:16 +01:00
parent 192e25f27e
commit aca12a3012
3 changed files with 11 additions and 2 deletions

View file

@ -51,7 +51,7 @@ namespace Nibriboard
FilePrefix = "Nibriboard.ClientFiles", FilePrefix = "Nibriboard.ClientFiles",
ClientSettings = clientSettings, ClientSettings = clientSettings,
SpaceManager = planeManager SpaceManager = planeManager
}, IPAddress.IPv6Any, Port); }, IPAddress.Any, Port);
} }
public async Task Start() public async Task Start()

View file

@ -221,7 +221,13 @@ namespace Nibriboard.RippleSpace
} }
public static async Task<Chunk> FromStream(Plane plane, StreamReader chunkSource) public static async Task<Chunk> FromStream(Plane plane, StreamReader chunkSource)
{ {
Chunk loadedChunk = JsonConvert.DeserializeObject<Chunk>(await chunkSource.ReadToEndAsync()); Chunk loadedChunk = JsonConvert.DeserializeObject<Chunk>(
await chunkSource.ReadToEndAsync(),
new JsonSerializerSettings() {
MissingMemberHandling = MissingMemberHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
}
);
loadedChunk.plane = plane; loadedChunk.plane = plane;
loadedChunk.Location.Plane = plane; loadedChunk.Location.Plane = plane;
foreach(DrawnLine line in loadedChunk.lines) foreach(DrawnLine line in loadedChunk.lines)

View file

@ -14,6 +14,9 @@ namespace Nibriboard.RippleSpace
/// </summary> /// </summary>
public ChunkReference ContainingChunk { public ChunkReference ContainingChunk {
get { get {
if(Plane == null)
return null;
return new ChunkReference( return new ChunkReference(
Plane, Plane,
X / Plane.ChunkSize, X / Plane.ChunkSize,