Skip to content

Commit 81efb9d

Browse files
committed
Attempt to fix SET_SUBSPACE. We were accessing a dictionary and attempting to stop KSP's warp from a thread.
1 parent 8ce0d9e commit 81efb9d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Client/WarpWorker.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class WarpWorker
3535
//Report tracking
3636
private double lastWarpSet;
3737
private double lastReportRate;
38+
private int newSetSubspace = -1;
3839
private Queue<byte[]> newWarpMessages = new Queue<byte[]>();
3940
private ScreenMessage warpMessage;
4041
private const float SCREEN_MESSAGE_UPDATE_INTERVAL = 0.2f;
@@ -68,6 +69,14 @@ public static WarpWorker fetch
6869

6970
private void Update()
7071
{
72+
//Switch to new subspace if told to - this needs to be before the workerEnabled check as it fires during the initial sync
73+
if (newSetSubspace != -1)
74+
{
75+
DarkLog.Debug("Sent to subspace: " + newSetSubspace);
76+
TimeSyncer.fetch.LockSubspace(newSetSubspace);
77+
newSetSubspace = -1;
78+
}
79+
7180
if (!workerEnabled)
7281
{
7382
return;
@@ -391,7 +400,7 @@ public void HandleSetSubspace(byte[] messageData)
391400
using (MessageReader mr = new MessageReader(messageData))
392401
{
393402
int subspaceID = mr.Read<int>();
394-
TimeSyncer.fetch.LockSubspace(subspaceID);
403+
newSetSubspace = subspaceID;
395404
}
396405
}
397406

0 commit comments

Comments
 (0)