Skip to content

Commit

Permalink
fix two bugs in multiplayer support
Browse files Browse the repository at this point in the history
sync the dequeue method
sync Tree initialization
  • Loading branch information
FluffierThanThou committed Jan 28, 2020
1 parent ee07c06 commit 0e10dd1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Binary file modified Assemblies/ResearchTree.dll
Binary file not shown.
2 changes: 0 additions & 2 deletions Source/Extensions/SyncWorker_ResearchNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class SyncWorker_ResearchNode
[SyncWorker]
static void SyncResearchNode( SyncWorker worker, ref ResearchNode node )
{

Log.Debug( $"Syncing" );
if ( worker.isWriting )
{
Expand All @@ -29,7 +28,6 @@ static void SyncResearchNode( SyncWorker worker, ref ResearchNode node )
}
}


[SyncWorker]
static void SyncResearchNodes( SyncWorker worker, ref IEnumerable<ResearchNode> nodes )
{
Expand Down
6 changes: 5 additions & 1 deletion Source/Graph/Tree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
using Multiplayer.API;
using UnityEngine;
using Verse;
using static FluffyResearchTree.Constants;
Expand Down Expand Up @@ -72,8 +73,11 @@ public static List<Edge<Node,Node>> Edges
}

private static bool _initializing = false;
[SyncMethod]
public static void Initialize()
{
if ( Initialized ) return;

// make sure we only have one initializer running
if (_initializing)
return;
Expand Down Expand Up @@ -105,7 +109,7 @@ public static void Initialize()
// done!
LongEventHandler.QueueLongEvent( () => { Initialized = true; }, "Fluffy.ResearchTree.PreparingTree.Layout", false, null );

// tell researh tab we're ready
// tell research tab we're ready
LongEventHandler.QueueLongEvent( MainTabWindow_ResearchTree.Instance.Notify_TreeInitialized, "Fluffy.ResearchTree.RestoreQueue", false, null);

}
Expand Down
1 change: 1 addition & 0 deletions Source/Queue/Queue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static void TryDequeue( ResearchNode node )
Dequeue( node );
}

[SyncMethod]
public static void Dequeue( ResearchNode node )
{
// remove this node
Expand Down

0 comments on commit 0e10dd1

Please sign in to comment.