Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions Source/Client/Syncing/Dict/SyncDictRimWorld.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using Multiplayer.API;
using Multiplayer.Client.Patches;
using Multiplayer.Common;
using RimWorld;
using RimWorld.Planet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using Verse;
using Verse.AI;
using Verse.AI.Group;
using static Multiplayer.Client.CompSerialization;
using static Multiplayer.Client.SyncSerialization;
using static UnityEngine.GraphicsBuffer;

// ReSharper disable RedundantLambdaParameterType

namespace Multiplayer.Client
Expand Down Expand Up @@ -1249,10 +1246,16 @@ public static class SyncDictRimWorld
data.WriteByte(2);
WriteSync(data, info.WorldObject);
}
else {
else if (info.Tile.Valid) {
data.WriteByte(3);
WriteSync(data, info.Tile);
}
else
{
if (info.IsValid)
throw new SerializationException($"Unable to serialize GlobalTargetInfo {info}");
data.WriteByte(byte.MaxValue);
}
},
(ByteReader data) =>
{
Expand All @@ -1263,8 +1266,10 @@ public static class SyncDictRimWorld
true) // True to prevent errors/warnings if synced map was null
,
2 => new GlobalTargetInfo(ReadSync<WorldObject>(data)),
3 => new GlobalTargetInfo(data.ReadInt32()),
_ => GlobalTargetInfo.Invalid
3 => new GlobalTargetInfo(ReadSync<PlanetTile>(data)),
byte.MaxValue => GlobalTargetInfo.Invalid,
var type =>
throw new SerializationException($"Unable to deserialize GlobalTargetInfo with type {type}"),
};
}
},
Expand Down
Loading