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

[server] Fix infinite loop in chunk sending logic in plane changer

This commit is contained in:
Starbeamrainbowlabs 2017-05-04 21:36:24 +01:00
parent 1b2d50b7af
commit 53f5d9e400

View file

@ -326,17 +326,21 @@ namespace Nibriboard.Client
CurrentViewPort = workingViewport; CurrentViewPort = workingViewport;
List<ChunkReference> initialChunks = new List<ChunkReference>(); List<ChunkReference> initialChunks = new List<ChunkReference>();
ChunkReference currentChunkRef = new ChunkReference(CurrentPlane, CurrentViewPort.X, CurrentViewPort.Y); ChunkReference currentChunkRef = new ChunkReference(
CurrentPlane,
CurrentViewPort.X / CurrentPlane.ChunkSize,
CurrentViewPort.Y / CurrentPlane.ChunkSize
);
while(CanSee(currentChunkRef)) while(CanSee(currentChunkRef))
{ {
while(CanSee(currentChunkRef)) while(CanSee(currentChunkRef))
{ {
initialChunks.Add(currentChunkRef); initialChunks.Add(currentChunkRef);
currentChunkRef = currentChunkRef.Clone() as ChunkReference; currentChunkRef = currentChunkRef.Clone() as ChunkReference;
currentChunkRef.X += CurrentPlane.ChunkSize; currentChunkRef.X++;
} }
currentChunkRef.X = CurrentViewPort.X; currentChunkRef.X = CurrentViewPort.X;
currentChunkRef.Y += CurrentPlane.ChunkSize; currentChunkRef.Y++;
} }
await SendChunks(initialChunks); await SendChunks(initialChunks);