1- using HarmonyLib ;
1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
24using Multiplayer . API ;
3- using Multiplayer . Client . Patches ;
45using Multiplayer . Common ;
56using RimWorld ;
67using RimWorld . Planet ;
7- using System ;
8- using System . Collections . Generic ;
9- using System . Linq ;
10- using System . Security . Cryptography ;
118using Verse ;
129using Verse . AI ;
1310using Verse . AI . Group ;
1411using static Multiplayer . Client . CompSerialization ;
1512using static Multiplayer . Client . SyncSerialization ;
16- using static UnityEngine . GraphicsBuffer ;
13+
1714// ReSharper disable RedundantLambdaParameterType
1815
1916namespace Multiplayer . Client
@@ -1249,10 +1246,16 @@ public static class SyncDictRimWorld
12491246 data . WriteByte ( 2 ) ;
12501247 WriteSync ( data , info . WorldObject ) ;
12511248 }
1252- else {
1249+ else if ( info . Tile . Valid ) {
12531250 data . WriteByte ( 3 ) ;
12541251 WriteSync ( data , info . Tile ) ;
12551252 }
1253+ else
1254+ {
1255+ if ( info . IsValid )
1256+ throw new SerializationException ( $ "Unable to serialize GlobalTargetInfo { info } ") ;
1257+ data . WriteByte ( byte . MaxValue ) ;
1258+ }
12561259 } ,
12571260 ( ByteReader data ) =>
12581261 {
@@ -1263,8 +1266,10 @@ public static class SyncDictRimWorld
12631266 true ) // True to prevent errors/warnings if synced map was null
12641267 ,
12651268 2 => new GlobalTargetInfo ( ReadSync < WorldObject > ( data ) ) ,
1266- 3 => new GlobalTargetInfo ( data . ReadInt32 ( ) ) ,
1267- _ => GlobalTargetInfo . Invalid
1269+ 3 => new GlobalTargetInfo ( ReadSync < PlanetTile > ( data ) ) ,
1270+ byte . MaxValue => GlobalTargetInfo . Invalid ,
1271+ var type =>
1272+ throw new SerializationException ( $ "Unable to deserialize GlobalTargetInfo with type { type } ") ,
12681273 } ;
12691274 }
12701275 } ,
0 commit comments